Skip to content

CyberSource ​

CyberSource Secure Acceptance is a hosted checkout for card payments, in MMK or any other currency.

CallWhat it doesReturns
cyberSource()->initiate($data)Signed form posted to the hosted checkoutFormPayment
cyberSource()->handleCallback($request)Verify the result postPaymentCallback

CyberSource has no status API in this package: the callback is the only payment result.

Responses shows what CyberSource puts in each result.

How it works ​

CyberSource posts the result twice, to your backoffice URL and through the browser to your receipt page, and both are verified the same way.

CyberSource: signed form, hosted checkout, two result postsCustomerYour appCyberSourceCheck outRedirect to autoSubmitUrlcyberSource()->initiate($data)Post to the hosted checkoutPOST /pay, then the card formBackoffice postoverride_backoffice_post_urlVerified callback is proofcyberSource()->handleCallback($request)Browser posts the receiptoverride_custom_receipt_pageSame signature checkcyberSource()->handleCallback($request)Show the receipt
CyberSource: signed form, hosted checkout, two result posts

Initiating a Payment ​

php
use Laranex\LaravelMyanmarPayments\Facades\MyanmarPayments;
use Laranex\PhpMyanmarPayments\CyberSource\CyberSourcePaymentData;
use Laranex\PhpMyanmarPayments\CyberSource\CyberSourceTransactionType;

$data = new CyberSourcePaymentData(
    orderId: 'ORDER_'.$order->id,
    amount: 10000,
    callbackUrl: route('payments.cybersource.callback'),
    currency: 'MMK',
    transactionType: CyberSourceTransactionType::Sale,
    locale: 'en-us',
    returnUrl: route('payments.cybersource.receipt'),
    cancelUrl: route('checkout'),
);

$payment = MyanmarPayments::cyberSource()->initiate($data);

return redirect($payment->autoSubmitUrl);

CyberSourcePaymentData ​

ParameterTypeRequiredRules
orderIdstringYesAt most 50 characters, sent as reference_number
amountAmount|intYesOrder total in currency, 0 or more, any number of decimals, at most 15 characters, e.g. 10000 or Amount::parse('10.50')
callbackUrlstringYesAbsolute http or https URL CyberSource posts the result to. At most 255 characters; CyberSource may require HTTPS in production
currencystringYesAny three-letter uppercase ISO 4217 code, e.g. MMK
transactionTypeCyberSourceTransactionTypeYesCyberSourceTransactionType::Sale ('sale'), ::Authorization ('authorization'), ::SaleAndCreateToken ('sale,create_payment_token') or ::AuthorizationAndCreateToken ('authorization,create_payment_token')
localestringYesHosted page language as a CyberSource locale code, e.g. en-us
returnUrl?stringNoReceipt page for the customer (absolute http or https URL). At most 255 characters
cancelUrl?stringNoPage shown when the customer cancels (absolute http or https URL). At most 255 characters

Amounts and Currencies ​

CyberSource is multi-currency and accepts decimals. For another currency, pass an Amount with the currency: amount: Amount::parse('10.50'), currency: 'USD'.

Form Encoding ​

CyberSource expects the form as application/x-www-form-urlencoded. $payment->enctype carries it; use it if you render the form yourself.

Handling Callbacks ​

CyberSource posts a form to callbackUrl. The same check works for the browser post to your receipt page.

php
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;
use Laranex\LaravelMyanmarPayments\Facades\MyanmarPayments;
use Laranex\PhpMyanmarPayments\Exceptions\SignatureVerificationException;

Route::post('/payments/cybersource/callback', function (Request $request) {
    try {
        $callback = MyanmarPayments::cyberSource()->handleCallback($request);
    } catch (SignatureVerificationException) {
        abort(400);
    }

    if ($callback->isSuccessful()) {
        // $callback->orderId is your req_reference_number
        // $callback->gatewayReference is CyberSource's transaction_id
    }

    return MyanmarPayments::acknowledge($callback);
})->name('payments.cybersource.callback');

Only signed fields are trusted: decision and req_reference_number must be listed in signed_field_names, transaction_id and the amount are read only when they are signed, and raw keeps only the signed fields plus signature. An unsigned extra field, such as decision=ACCEPT added to a re-posted checkout form, can't change the result.

Responses ​

What CyberSource puts in each property. See Results and PaymentCallback & Status for the full classes. CyberSource posts form fields, so every raw value is a string, exactly as sent.

initiate() → FormPayment ​

Property / MethodCyberSource value
orderIdYour orderId
action{base_url}/pay, e.g. https://testsecureacceptance.cybersource.com/pay
fieldsThe signed fields below. Post them unchanged
enctypeapplication/x-www-form-urlencoded
autoSubmitUrlEncrypted link to the myanmar-payments.form route, e.g. https://shop.test/myanmar-payments/form?payload=…. Expires after form_route.ttl_minutes. null when form_route.enabled is false
toHtml()A full HTML page that posts fields to action on load

fields, all signed, in this order:

Form fieldValue
access_keyYour configured access key
profile_idYour configured profile ID
transaction_uuidA random ID, new for every call
signed_field_namesThe field names in this table except signature, comma-separated
signed_date_timeUTC time, e.g. 2026-10-08T09:30:00Z
localeYour locale, e.g. en-us
transaction_typeYour transactionType, e.g. sale
reference_numberYour orderId
amountYour amount, e.g. 10000
currencyYour currency, e.g. MMK
override_custom_receipt_pageYour returnUrl, "" when unset
override_backoffice_post_urlYour callbackUrl
override_custom_cancel_pageYour cancelUrl, "" when unset
signatureBase64 HMAC-SHA256 of the signed fields

initiate() makes no HTTP call. FormPayment has no raw: nothing is sent to CyberSource until the customer's browser posts the form.

handleCallback() → PaymentCallback ​

Property / MethodCyberSource value
orderIdCyberSource req_reference_number (your orderId)
statusdecision mapped, see Statuses
gatewayStatusCyberSource decision, trimmed and uppercased, e.g. ACCEPT
gatewayReferenceCyberSource transaction_id. null when it is not signed
amountCyberSource auth_amount, falling back to req_amount when it is missing or empty, e.g. 10000. Signed values only
rawThe signed fields of the verified post plus signature, e.g. decision, reason_code, message, transaction_id, auth_amount, auth_code, req_reference_number, req_amount, req_currency, req_transaction_uuid, signed_field_names, signed_date_time. Unsigned fields are left out
acknowledgementHTTP 200, empty body, Content-Type: text/plain

MyanmarPayments::acknowledge($callback) turns acknowledgement into a CallbackResponse (Responsable). handleCallback() accepts an Illuminate\Http\Request or a CallbackRequest.

Statuses ​

CyberSource decisionPaymentStatus
ACCEPTSuccessful
REVIEWPending
DECLINE, ERRORFailed
CANCELCanceled
anything elseUnknown

Errors ​

CallThrowsWhen
new CyberSourcePaymentData(...)InvalidPaymentDataExceptionA value breaks the rules above. Nothing is signed
handleCallback()SignatureVerificationExceptionsignature doesn't match, a field listed in signed_field_names is missing, or decision or req_reference_number isn't signed

CyberSource makes no HTTP calls, so nothing throws ApiException.

Released under the MIT License, except where a package says otherwise.