Payments

Payment methods

A payment method holds how the customer pays: card details, an e-wallet, a bank, or a pay-later provider. It does nothing on its own until it is attached to a payment intent.

Read the Payment Methods docs

Every demonstration here makes a real PayMongo API call in test mode. Nothing is simulated, and no real money moves.

Create card payment method

A card payment method. The default is a PayMongo test card that succeeds without 3D Secure.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'card',
        'details' => [
            'card_number' => '••••4345',
            'exp_month' => '••',
            'exp_year' => '••',
            'cvc' => '•••',
        ],
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create GCash payment method

An e-wallet payment method. Attaching it returns a redirect where the customer authorises the payment.

Test mode: No wallet account is needed. The outcome is decided after attach, on the PayMongo test page the redirect opens, where you choose Authorize or Fail; the Playground cannot make that choice for you.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'gcash',
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create GrabPay payment method

An e-wallet payment method. Attaching it returns a redirect where the customer authorises the payment.

Test mode: No wallet account is needed. The outcome is decided after attach, on the PayMongo test page the redirect opens, where you choose Authorize or Fail; the Playground cannot make that choice for you.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'grab_pay',
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create Maya payment method

An e-wallet payment method. Attaching it returns a redirect where the customer authorises the payment.

Test mode: No wallet account is needed. The outcome is decided after attach, on the PayMongo test page the redirect opens, where you choose Authorize or Fail; the Playground cannot make that choice for you.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'paymaya',
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create ShopeePay payment method

An e-wallet payment method. Attaching it returns a redirect where the customer authorises the payment.

Test mode: No wallet account is needed. The outcome is decided after attach, on the PayMongo test page the redirect opens, where you choose Authorize or Fail; the Playground cannot make that choice for you.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'shopee_pay',
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create QR Ph payment method

A QR Ph payment method. Attaching it produces a QR code the customer scans with any QR Ph banking app.

Test mode: In test mode QR Ph generates real QR codes. Do not scan and pay them: that processes a real transaction.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'qrph',
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create BillEase payment method

A buy now, pay later payment method. The customer completes the BillEase flow after it is attached.

Test mode: The outcome is decided after attach, on the BillEase redirect page, so it cannot be triggered from here.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'billease',
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create direct online banking payment method

A direct online banking payment method for BPI or UnionBank, chosen by bank code.

Test mode: The bank code test_bank_one simulates BPI and test_bank_two simulates UnionBank. The OTP that decides the outcome is entered on the redirect page after attach.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'dob',
        'details' => [
            'bank_code' => 'test_bank_one',
        ],
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create Brankas payment method

A direct online banking payment method through Brankas, chosen by bank code.

Test mode: PayMongo documents no test bank code for Brankas, only bdo, metrobank, and landbank. The outcome is decided on the redirect page after attach.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'brankas',
        'details' => [
            'bank_code' => 'bdo',
        ],
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Create Atome payment method

An Atome buy now, pay later payment method.

Test mode: Atome is in the package's payment method types but not among the types PayMongo's Create a Payment Method reference lists, so your account may reject it.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->create(
    attributes: [
        'type' => 'atome',
        'billing' => [
            'name' => '••••',
            'email' => '••••',
            'phone' => '••••',
        ],
    ],
);

Retrieve payment method

Fetch a payment method created in the Playground.

PHP
use Luigel\Paymongo\Facades\Paymongo;

$paymentMethod = Paymongo::paymentMethods()->retrieve(
    id: '{payment_method id}',
);