Integrating Paypal Payment and Invoicing APIs - paypal

I have been manually issuing invoices to charge my clients for services using Paypal.
Now I am creating an interface to allow them to purchase the services automatically on my website.
I also want to show them a history of their purchases. However, I cannot show a history of paid invoices using the Transaction Search API; I need to use the Invoicing > Search Invoices API.
I have used the Paypal Payments API to manage the payment side of new products, which now correctly produces an itemised transaction and allows the customer to checkout. But this does not produce an invoice.
How can I simultaneously produce an invoice (i.e which can be retrieved by the Invoicing API to show previous payments) and allow the customer to pay it? It seems like the Invoicing API works around the idea of sending an invoice to client by email, but this is unnecessary. I want them to pay it immediately (and already have the Payment API setup for this).
So what would a useful workflow be?: Use my Paypal Payment API to receive and authorise the payment, and on authorisation, use the Invoicing API to produce an invoice which reflects this and then updates the invoice status to paid? Or am I missing something easier here?

The Invoicing API is not meant to be mixed or used with any other API. It is for generating invoices to be sent by email or in link form.
General ecommerce payment processing (without invoice links) is entirely separate, there is no crossover. You should ensure you are using the current v2/checkout/orders API to receive new payments, not older v1 APIs.
As far as displaying a list of previous purchases to your customers, you shouldn't reply on PayPal for this (except perhaps in the case of invoices since this is part of the point of offloading invoice management to PayPal). But for normal web purchases, PayPal is not a database -- it is a payment processing service. Keep track of all your own order information, and simply store PayPal transaction IDs when they complete for your own accounting records -- but the ID you reference with the customer should be your own unique order ID, which you can pass to PayPal in your purchase_units[0].invoice_id when you create an order for checkout approval.

Related

PayPal - Pass Customer ID from my website - Receive confirmation with same Customer ID from my website

I am working on a software service and am offering a monthly subscription for my software service.
I am currently working on the subscription part - and am wanting to implement a paypal monthly recurring payment solution.
I have spent quite a bit of time looking over PayPal documentation, and trying different buttons, webhooks, IPN methods etc.
The problem is that I am not sure what solution to use - because I am confused by the multiple options.
What is most important to me is - that when the customers fill out the form on my website - and are then directed PayPal to pay - I then want to know that specific Customer ID from my website has successfully paid.
I would like to know:
Which SPECIFIC option(s) PayPal has that I can pass Customer ID from my website of that customer - let's say a subscription ID from my site - and that PayPal will then send the customer back with my subscription ID, that I passed them on to PayPal with.
Which is the easiest option to do that with?
I simply want the customer to:
sign up at my site. (my part)
be issued a unique Customer ID from my website (my part)
click a PayPal payment/subscribe button (my part)
be sent to PayPal to pay for the subscription (paypal's part)
be returned to my site with the unique Customer ID from my website from my site - as well as a confirmation of payment from PayPal (paypal's part)
Please do not simply pass me to the general area of the development sections -
As I said - I have already been through all of that and find there is too much information.
Please direct me to a specific solution, or example, or tutorial that covers a solution that will fit what I need.
I would recommend using the Express Checkout API with Recurring Payments.
The best thing to do would be to create a local invoice record in your system, and then have a related customer ID associated with that invoice.
In the CreateRecurringPaymentsProfile request to PayPal you can include a PROFILEREFERENCE parameter, which would be the invoice ID you generated for that order in your system. Then all future payments related to that profile would include this same reference ID as part of its data, so if you're using IPN, for example, it would be included there.
When working with Express Checkout the user is always guaranteed to end up back on your site to finish the checkout flow, so you can simply save data in sessions during checkout and update things like your database, email receipts, etc. directly in your payment flow. Then you could use IPN to process the recurring payments after that, and again, it would include that same reference ID. In IPN this would come back as rp_invoice_id.

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

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?
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:
Create Billing Agreement with seller
Visit Express Checkout page
http://localhost:3000/checkout/callback_success is called
Receive token
Redirect to payment URL (which uses token received)
Receive token
Create a billing agreement
(no redirection or confirmation happens)
Receive and store a billing agreement token in database
You now have the ability to process payments in the future for arbitrary transaction amounts using the Billing Agreement ID

Xero API - Payments

I am trying to integrate the Xero API into an application I am working on. I have the ability to get the invoices as well as set up new payment.
I want to make it so that customers can come online and pay their invoice using Go Cardless and then mark the invoice as paid once the payment has gone through.
Can I do this using the API or will I need to integrate the Go Cardless API in order to do this and then once it's successful it then marks the payment as complete?
Not sure about Go Cardless.
But once the invoice is paid through your app, you need to make sure that you write back information to Xero to make that invoice status change to Paid.
You can do it through Invoices and Paymnets Endpoint.
You need to add Payments against that Invoice ID. once the invoice is fully paid, status of that will change to PAID.
Apply payments to approved AR and AP invoices
More information on request object for Payments Endpoint:
Payments
More Documentation for Invoices

Retrieve transaction ID via rest API

My application uses PayPal java library to make payments. Everything works fine but I can't understand one thing. What exactly is transaction code? Let's say I make a payment and then approve it. As a result I receive the JSON object which has an ID (PAY-*) and transactions->related resources->sale->ID. Both of them I store in the DB in order to show later to user (in case he wants to refund the money). But if I see these payments from PayPal customer portal, in the descriptions of payment I see non of these ID's.. Transaction code is totally different! So which one of them should I store?
Thank you in advance
PayPal generally uses a transaction ID. It's a 16 character alphanumeric string. This will appear in both your API response and the PayPal site. Assuming REST is like Classic, the Transaction ID is how you will reference the payment for any future operations (capture, refund, etc).
Please note that if you're using Express Checkout (where the customer pays via PayPal account) they will have their own transaction ID for the exact same transaction.

Which Paypal API for preapproved payments?

I'm trying to implement PayPal on a completely custom shopping cart and have been unable to figure out which API for recurring payments we need.
We ship a physical product every 2, 3, 4, 6 months so shipment and payment have to both happen together. In addition it must be easy for the user to change their shipment date - or add or remove items to their regular shipments without too much stress (either on their part or mine).
I've generally looked at Paypal's recurring billing as more suited to software based subscriptions and I don't think this is the API I need. I'd like to just bill the customer via a billing agreement and then initiate the shipment.
The way Skype does it seems to be ideal - they establish a billing agreement (shown in my PayPal account under 'My account > Profile > Pay List'
but I cannot seem to find that in the SOAP API document.
What is the API I need to create a billing agreement that I can trigger whenever I want. Can this be done with Express Checkout API ?
The API you are looking for is called reference transactions. This allows you to set up a billing agreement with a customer, get back a token, and then use that token to issue charges in the future. It can be done via the Express Checkout API.
You have to contact PayPal customer support to get this activated for your account before you can use it.