I am trying to vault a card using PayPal’s PayPalButtons, but I am not receiving the billingToken in the onApprove response.
What I Have Tried:I have enabled Vaulting in the PayPal Developer Dashboard, and my PayPal integration looks like this:
- Frontend Code (React, PayPal Buttons)
<PayPalScriptProvider options={{ clientId: "test", components: "buttons", currency: "USD", intent: "capture", vault: true }}><PayPalButtons createOrder={(data, actions) => { return actions.order.create({ purchase_units: [{ amount: { value: "9.99" } }], }); }} onApprove={(data, actions) => { console.log("Order Approved:", data); if (!data.billingToken) { console.error("No billingToken received!"); } return actions.order.capture().then((details) => { console.log("Capture Details:", details); }); }}/></PayPalScriptProvider>
- Expected Behavior:data.billingToken should contain a vault token that I can send to my backend.
I should be able to store this token and charge the user later.
- Actual Behavior (Issue)billingToken is always null.
The onApprove response looks like this:
{"orderID": "3L820413VH915090N","payerID": "E3T6H4CYL8AZ8","paymentID": "3L820413VH915090N","billingToken": null,"facilitatorAccessToken": "XXXXXXXXXXXX",}
Things I Have Checked:
Vaulting is enabled in my PayPal Developer Dashboard.
Tried setting { vault: true }, but it's no longer a valid prop in PayPalButtons.
Verified that my PayPal account supports Vaulting.
Question:
Why is billingToken always null?
How do I properly vault a card and get the token in the response?
Is there a new way to vault payments in the latest PayPal API?
Any help would be greatly appreciated!