Saved paypal payment integration

mr-dev
Contributor
Contributor

Hi, I have a few questions regarding PayPal saved payments integration.


I was able to save the PayPal customer Id and vault id during the initial order, as outlined in the documentation: PayPal Documentation

When a customer makes a second order, I pass the vault_id as the payment source like this:

[
'intent' => 'CAPTURE',
'purchase_units' => [
[
'amount' => ['value' => $amount, 'currency_code' => $currencyCode],
'invoice_id' => $invoiceId,
'description' => $description,
],
],
'payment_source' => [
'paypal' => [
'vault_id' => $paypalVaultId,
]
],
]


The order is successfully created, and the payment is captured immediately. However, the main issue is that the PayPal JS SDK receives the second order ID and throws a PAYMENT_ALREADY_DONE error.

How can I correctly use the PayPal customerId and vault_id to avoid requiring confirmation from the customer and prevent the frontend from throwing any errors?
My goal is to make any future orders submit by one click, so no need for customer to confirm any data etc. Now order is created in backend, but fontend is not able to handle it correctly.

Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.