Payment Intents
#
Create Payment IntentA payment intent is designed to handle a complex payment process. To compare payment intents with tokens, tokens have a straight forward credit card payment process where it does not check if 3DS is required to fulfill a payment while payment intent is designed to handle such process.
#
PayloadRefer to Paymongo documentation for payload guidelines.
#
Sampleuse Luigel\Paymongo\Facades\Paymongo;
$paymentIntent = Paymongo::paymentIntent()->create([ 'amount' => 100, 'payment_method_allowed' => [ 'card' ], 'payment_method_options' => [ 'card' => [ 'request_three_d_secure' => 'automatic' ] ], 'description' => 'This is a test payment intent', 'statement_descriptor' => 'LUIGEL STORE', 'currency' => "PHP",]);
#
Cancel Payment IntentCancels the payment intent.
#
Sampleuse Luigel\Paymongo\Facades\Paymongo;
$paymentIntent = Paymongo::paymentIntent()->find('pi_hsJNpsRFU1LxgVbxW4YJHRs6');$cancelledPaymentIntent = $paymentIntent->cancel();
#
Attach Payment IntentAttach the payment intent.
#
Sampleuse Luigel\Paymongo\Facades\Paymongo;
$paymentIntent = Paymongo::paymentIntent()->find('pi_hsJNpsRFU1LxgVbxW4YJHRs6');// Attached the payment method to the payment intent$successfulPayment = $paymentIntent->attach('pm_wr98R2gwWroVxfkcNVZBuXg2');
#
Get Payment IntentYou can retrieve a Payment Intent by providing a payment intent ID. The prefix for the id is pi_
followed by a unique hash representing the payment. Just pass the payment id to find($paymentIntentId)
method.
#
Sampleuse Luigel\Paymongo\Facades\Paymongo;
$paymentIntent = Paymongo::paymentIntent()->find('pi_hsJNpsRFU1LxgVbxW4YJHRs6');