Skip to content

Payment Capture

Guilherme Pressutto edited this page Jun 13, 2017 · 2 revisions

If you set $payment->card->autoCapture to false you'll need to manually capture the payment using its Hash or its Merchant Payment Code.

EBANX($config, $creditCardConfig)->creditCard()->captureByHash('hash');

You can either call captureByHash() or captureByMerchantPaymentCode(). They both are very similar. The only difference is the first argument of each function which are respectively the hash or the merchant payment code.

The following two arguments are optional. You can set the amount you want to capture. Eg: A payment had a pre-approved credit of 30$, but you want to capture only 20$. You can do this with the second argument:

EBANX($config, $creditCardConfig)->creditCard()->captureByMerchantPaymentCode('merchant payment code', 20);

The last argument is the Merchant Capture Code that you can use only to identify the capture. If you want to set a capture code but want to capture the whole pre-approved credit you can set amount to null:

EBANX($config, $creditCardConfig)->creditCard()->captureByMerchantPaymentCode('merchant payment code', null, 'merchant capture code');
Clone this wiki locally