Repository navigation
Add Xendit driver - #32
Merged
Merged
Conversation
Xendit covers Indonesia, the Philippines, Malaysia, Thailand, Vietnam and Singapore, on Payment Sessions in PAYMENT_LINK mode - the product Xendit's docs point new integrations at, with the legacy Invoice API listed under 'migrate to Payment Session': - createPayment() creates a session and returns the hosted payment link. - Webhooks carry no HMAC: the dashboard's token comes back in x-callback-token and is compared in constant time. Only the documented session events are read, and a completed event is re-checked against the session's own status, so an unpaid session never comes through as paid. - Refunds are keyed by Xendit's payment_id, with the amount required and the documented reason enum, and a pending refund settles by its own webhook.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
Tahseel::gateway('xendit')- South-East Asia (Indonesia, the Philippines, Malaysia, Thailand, Vietnam, Singapore), on Payment Sessions inPAYMENT_LINKmode. Xendit's own docs point new integrations at Payment Sessions and list the older Invoice API under "migrate to Payment Session", so that is what the driver builds on.createPayment()-POST /sessionswith Basic auth (secret key as the username, empty password, as documented) and theapi-versionheader. Returnspayment_link_urlas the checkout url. Amounts are the currency's smallest unit.verifyAndParseWebhook()- no HMAC exists for this flow. Xendit echoes your dashboard token inx-callback-token, and its docs say comparing it is how you know an event came from them. The driver compares in constant time, refuses a missing or wrong token, reads onlypayment_session.completedandpayment_session.expired, and re-checks a completed event against the session's own status so a session that is notCOMPLETEDcomes through pending. Statuses outsideCOMPLETED/ACTIVE/EXPIRED/CANCELEDare refused.refund()-POST /refundskeyed by Xendit'spayment_id(the session webhook carries it), amount required, reason mapped to the documented enum (REQUESTED_BY_CUSTOMERunless you pass a documented code).SUCCEEDED/PENDING/FAILEDmapped; a pending refund settles by its own webhook.Honesty notes
Metadata
README (EN) +
docs/ar/README.mdin sync (count 21 → 22, driver table, refund table, full## Xenditsection), CHANGELOG [Unreleased],composer.jsondescription + keywords (xendit,indonesia,idr,southeast asia), config block +XENDIT_*env vars, every optional extra off by default.Tests
16 fixture tests. Suite 593 passed / 1421 assertions, PHPStan level 8 clean, Pint clean.