最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

reactjs - PayPal Vaulting: billingToken is null in onApprove response - Stack Overflow

programmeradmin6浏览0评论

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:

  1. 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>
  1. 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.

  1. Actual Behavior (Issue) billingToken is always null.

The onApprove response looks like this:

{
    "orderID": "3L820413VH915090N",
    "payerID": "E3T6H4CYL8AZ8",
    "paymentID": "3L820413VH915090N",
    "billingToken": null,
    "facilitatorAccessToken": "XXXXXXXXXXXX",
}

  1. 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.

  2. 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!

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:

  1. 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>
  1. 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.

  1. Actual Behavior (Issue) billingToken is always null.

The onApprove response looks like this:

{
    "orderID": "3L820413VH915090N",
    "payerID": "E3T6H4CYL8AZ8",
    "paymentID": "3L820413VH915090N",
    "billingToken": null,
    "facilitatorAccessToken": "XXXXXXXXXXXX",
}

  1. 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.

  2. 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!

Share Improve this question asked Mar 27 at 11:06 Pratik SahuPratik Sahu 1
Add a comment  | 

1 Answer 1

Reset to default 0

actions.order.create is deprecated and should not be used for any integration. delete it.

Follow the guide to create an order for vaulting from your backend service using the API https://developer.paypal/docs/checkout/save-payment-methods/during-purchase/js-sdk/paypal/

发布评论

评论列表(0)

  1. 暂无评论