I have managed to complete a PayPal payment using the REST PHP API. However, I want to know how to cross reference the REST transaction with the PayPal web user interface.
On the REST side I have payment id (getID()) received before the transaction is approved. It looks like 'PAY-5BH83448XN85470XXXXXXXXXXX'.
After the transaction is approved, I receive back at my redirect URL three other pieces of information:
- success=true
- token=EC-51Y92978Mxxxxxxxx
- PayerID=4Q7YVxxxxxxxx
When I log into PayPal and review the payment, none of these IDs match up with what is shown. The details for the payment show a Unique Transaction ID like #4PP59868EXXXXXXXX that does not match anything above.
How do I cross reference these different pieces of data?
The response to the payment call will contain a list of transactions, which contains a set of related resources. For a completed payment there will be a sale item, the id of the sale is the PayPal transaction id.
For ex (pseudo): payment.transactions[0].related_resources[sale].id
Sample here: https://developer.paypal.com/webapps/developer/docs/integration/direct/accept-credit-cards/
Related
We've implemented the Paypal Express API through Authorize.Net in PHP (https://developer.authorize.net/api/reference/features/paypal.html). It was finished over a year ago, and has been working fine. What we realized recently, is that the when the Paypal authorization is updated in step 2 "Authorization Only, Continued", it is not updated in Authorize.Net . When a capture takes place, it only captures the original amount, despite Paypal having the correct, updated amount.
Here is our flow (following the Authorize.Net/Paypal API instructions):
We send a request to Authorize.Net/Paypal to create a transaction. Inside is the total cost of goods.
Paypal returns a secure link, onto which we redirect the user
Paypal redirects the user back to us with a token. We use the token to get shipping data for the user and to get the authorization/transaction ID.
We calculate tax based on shipping data and send the user to a confirm page for review.
When the user submits, we send the second authorization request (Authorization Only, Continued), as documented, using the gateway transaction ID to update the transaction with the new amount, etc.
Now the problem is, Authorize.Net still has the original amount (without the tax). When we run a capture on this transaction via the same API, for some reason it only captures the original amount, not the amount with the tax. We're making tons of transactions now, and not receiving the tax dollars for any of them.
Here is the same transaction in Paypal and Authorize.Net. Paypal's screen shows the authorization at $120, and the update at $130.xx with shipping.
And Authorize.Net shows it successfully captured at $120.
These are the same transaction, and we're only using the Authorize.Net Paypal Express API. How is Authorize.Net not getting the update? Why is it not capturing the full amount?
When we run a capture on this transaction via the same API, for some reason it only captures the original amount, not the amount with the tax.
You need to either:
Capture the second authorization, not the original transaction. This should be the correct solution.
Send a capture request that includes the details of the new amounts you are capturing.
I am working on implementing Authorize.Net's Automated Recurring Billing API in Laravel Framework.
The scenario is I have a site, users sign up for our services and we charge them on monthly basis, and for that we have implemented automated recurring billing.
But I am unable to get the transaction id of successfully placed transactions.
ARB does not return a transaction ID when a payment is processed. It only establishes the recurring subscription. If you want transaction IDs of every successful subscription payment you will need to use one of two options available to you.
Webhooks
You can set up a webhook using the Webhooks API to be notified whenever a successful payment is made for a subscription. Although very little information is sent over with a webhook as it is best paired with the Transaction Details API, the transaction ID is one of the pieces of information sent with a webhook notification.
Silent Post
Silent Post is very similar to Paypal's IPN. Whenever a transaction is made Authorize.Net will send transaction details to a URL you specify which includes the transaction ID. Handling a Silent Post notification is easy as it looks exactly like a form submission.
Silent Post has been deprecated and will be going away so it is not recommended that you use this any more.
Disclosure: I wrote the articles about Webhooks and Silent Post.
I am using PayPal PHP SDK for processing PayPal payments.
A user adds items to my cart and then chooses to pay via PayPal. I construct a Paypal PAYMENT, send the PAYMENT to Paypal, the user logs in and approves the PAYMENT. The user is then redirected back to my website with the three $_GET parameters where I can then execute the PAYMENT.
All good so far.
According to the code, a PAYMENT holds an array of TRANSACTIONS. It seems each TRANSACTION holds an AMOUNT.
My Question: How do I retrieve what the user paid? If there are multiple TRANSACTIONS that can take place under one PAYMENT - how do I know which TRANSACTION'S AMOUNT to use?
(When I pass the initial PAYMENT to PayPal for approval, I do only provide one TRANSACTION, so I would assume when PayPal returns the approval back to my site, there will still be only one TRANSACTION, however, I do not want to assume this will always be the case!)
I am implementing PayPal payment to my application.
I am using Laravel Framework and merchant-sdk-php package to handle NVP/SOAP API. I would accually prefer REST API, but i need customers to make Reference Transactions with various amount, in non regular time periods and as far as i know it's possible only with NVP/SOAP API.
The payment flow in shortcut:
1. Payer clicks "connect" button, which is to create billing agreement using "SetExpressCheckout" method. Amount is set to 0 and adding a Billing Agreement field to request. Customer is redirected to PayPal, log in to his account, agreeing to direct debit and finally redirected to my return url.
2. After response is come, return action is fired (the one, which is passed in returnurl field). Next using token from paypal resposne i use CreateBillingAgreement method to get "BillingAgreementID" which i store in database.
3. Using "BillingAgreementID" i make "DoReferenceTransaction" request. No prompt to login is occurring, everything is happening behind the scene. Finally i get response after transaction.
The thinks i want to know are:
1. Is there a way, to get an email address, which consumer used to log in when creating billing agreemenet? I want to show in application which PayPal account (related to mentioned email) is direct debit set to?
2. I want to make some action in databse both after "BillingAgreementID" and "DoReferenceTransaction". Is the response status "Success" and additionally in "DoReferenceTransaction" field "PaymentStatus" set to "Completed" enought to conclude, that transaction is fully completed, and i cant i.e. share some digital goods or should i wait for IPN from this request?
Thanks for all contributions!
Found solution to question 1.
After betting billing agreement id i had to make "GetBillingAgreementCustomerDetails" action. In response i got customer details including email.
Still watching for hint to second question
I have written and successfully processed paypal functions on my clients site. They just want to be able to finalize the bill after they have shipped the product as the cost is very hard to calculate as products vary in size, quantity, ect. I currently have it set up so that they authorize a payment after using express checkout API as I have set $paymentType = "Authorization"; in stead of sale as the paymentType. All orders are tracked and logged in the database of the clients site they get a list of what the customer ordered, shipping info, ect on the admin side of the site. Only problem is once they have completed the order they mark it done on their site they must log into paypal and finalize the order by capturing the funds. How would I go about to capture funds using the classic API? I have found how to do it using the rest api, but I'm not going to rewrite my site to do it.
From the research I have done I have found that you can do it as I stated with the rest api and nvp or merchant api, but I'm using Express Checkout in PHP. I haven't been able to find how to use PHP and capture the funds.
My current code set up looks like this
//Orders are listed out using an array of mysql databases
......
**Where I need assistance**
//Capture funds from Paypal here
//return status of successful via self posting form
....
//And then I have
//a get function that marks the order as completed in the database
To summarize my question is how would(if possible) using the classic api and express checkout capture funds from paypal? As you can see I have given some thought to this I'm just stuck and can't figure it out.
The DoCapture API is what you're looking for. You'll pass in the transaction ID you got back from the Express Checkout Authorization along with the amount you're capturing.