How can I obtain a token to charge authorized PayPal accounts as needed?

858 Views Asked by At

I have a white labeling Shopify app that bills store owners who install my app whenever orders for my vendor are created in their store. Currently I use Authorize.net as a payment processor. Store owners perform an initial setup whereby they authorize their credit card using a web form I provide. This provides me with a customer profile ID and a customer payment profile ID for the store owner, and I use these two ids to charge their credit card via Authorize.Net for each and every order that is placed through their store for when the order contains one or more of my white label products.

So essentially I have Authorize.Net tokens for each store, and I use those tokens to charge store owners' credit cards as orders come in through their store, and each order has a different charge amount (this is not a recurring payment that is of the same amount each time). Here is some sample code.

I'd like to use PayPal as a backup payment processor and reproduce this same functionality. I'm looking through PayPal's API as well as the Node SDK, and I am not sure how to accomplish the same thing with PayPal. I essentially want to obtain a token tied to the store owner's account which I can use to charge the seller for each order, and each order can have a different charge amount.

Can someone point me in the right direction?

1

There are 1 best solutions below

0
On

Turns out that what I wanted seems to be Reference Transactions.

For documentation see https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECReferenceTxns/.

For an example see this project which uses the paypal-ec2 Node package.

The flow for the example project mentioned above appears to be as follows:

  1. Create Billing Agreement with seller
    1. Visit Express Checkout page
    2. http://localhost:3000/checkout/callback_success is called
    3. Receive token
    4. Redirect to payment URL (which uses token received)
    5. Receive token
    6. Create a billing agreement
    7. (no redirection or confirmation happens)
    8. Receive and store a billing agreement token in database
  2. You now have the ability to process payments in the future for arbitrary transaction amounts using the Billing Agreement ID