I am using PayPal iOS sdk to accept payment from user in my iOS app. I am using sandbox for testing. The payment is working fine, I am getting successful payment response along with Payment_ID. I am passing that Payment_ID to my server and from there using REST API (Show payment details), I am trying to retrieve all the information related to that payment but it is not consistent response.
Sometimes I am getting transaction_fee while sometimes it does not return in API response.
I see there is another NVP/SOAP method to get details but that requires transaction_id while i am only having Payment_ID.
does anyone have solution on how to get transaction fee from paypal?
I got the solution now!
I was receiving Payment_ID in response from from Paypal iOS SDk after payment successfully done. I am passing that to my server and the server is calling Show payment details REST API to get all payment details
GET /v1/payments/payment/payment_id
In above API response for some cases when transaction state is completed, paypal does not returning transaction_fee_amount. but it returns sale-->id (transactionId).
Using Paypal PHP Library, I used that transactionId and made NVP call for below API,
https://developer.paypal.com/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/
Voila!! In successfull response of that I am getting all the details for that transaction.
Related
I have integrated Stripe with iOS and the payments are working with the test cards, however, I cannot find a way to get payment transaction id so that I can store the transaction id on my server for future reference.
I looked into STPPaymentResult and STPPaymentContext but couldn't find anything.
So is there a way I can get the transaction id after the payment has been charged using Stripe in iOS application?
I found that STPPaymentResult returned during didCreatePaymentResult does contain transaction id. You can get it by paymentResult.source.stripeID
I want to create some tests to check my subscription failed processus.
At first I use a good working card (42...) and subscribe then I want to update the card of the Stripe Customer with the bad working card (40...4) to check the code of my webhook in case of failed subscription.
The problem I encounter, is to update a customer card, I should have a token, but my tests are written only server side (no javascript).
Is there any way to generate a token from server-side with Stripe?
Thanks in advance
I have been trying to integrate PayPal payment with a test application I am developing. If successful, I am thinking of leveraging this on my other projects.
So far, I have been able to add the plugin, configure it for Test environment and able to complete a transaction end to end. However, I have a small issue that I want some help or clarification about. Please follow the series of images below for more details:
Button on merchant application (grails application)
Payment page on PayPal test site
Here is the paypal confirmation page for transaction:
After making the payment above, I got a successful message on paypal test site. But when I check the logs and database, there is no notification sent to the grails application at this stage. The payment transaction is still in PENDING state:
Now, when I click on the "Return to merchant" link on the paypal confirmation page, then I redirected to my grails application with a SUCCESS message:
So, the PayPal "SUCCESS" response is sent to the grails/merchant application only after the user hits that link "Return to merchant site". In real life, the users might not want to return to the merchant site everytime. Seeing the confirmation message on PayPal site, they might assume that the transaction is done and may be PayPal does the payment too. But, how do we let the merchant site i.e the grails application know that the PayPal has already shown the user a confirmation message? So that, the user doesn't have to return to merchant site after seeing the Successful message?
UPDATE:
I have tried the IPN simulator upon your advice. I am not quite sure and able to understand how I can send an IPN message to my localhost application. When I tried giving my localhost or 127.0.0.1 on the IPN simulator configuration on my sandbox account, it throws error saying unable to reach the server. I am sure many developers must have tried this using local development machine, but unable to find any resource which gives the steps to use IPN simulator or IPN sandbox response for a localhost development instancE.
You cannot rely on PDT
you have to use IPN
where PayPal send a notification to a page on your website where you have to authenticate, verify several possible issues and save the transaction details
See here fore more info
IPN
Not sure if it written at that link, but you have also to enable such function from your Paypal account indicating the target page on your website.
I have a specific question about the verification side of Paypal (using the latest iOS PayPal SDK)
From this document: https://github.com/paypal/PayPal-iOS-SDK/blob/master/docs/single_payment.md
This is mentioned:
Send the payment response to your servers for verification, as well as any other processing required for your business, such as fulfillment. Tip: At this point, the payment has been completed, and the user has been charged. If you can't reach your server, it is important that you save the proof of payment and try again later.
And from there is a link to the verify-mobile payments documentation, in which various things are mentioned, i'm assuming this part applies to the iOS SDK (latest)
Looking up a payment using the REST API
You can payment id value in a response to look up a payment by calling the REST API. The following example retrieves a payment in the sandbox:
curl
https://api.sandbox.paypal.com/v1/payments/payment/PAY-5YK922393D847794YKER7MUI
\ -H "Content-Type: application/json" \ -H "Authorization: Bearer
{accessToken}" You should verify that the Payment:
Is approved ("state": "approved"). Contains a Transaction with: An
Amount with total and currency that match your expectation. A Sale
that is completed (in related_resources, with "state": "completed").
The live endpoint is
https://api.paypal.com/v1/payments/payment/{payment_id}.
https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/
Got it. So given the above assumptions (which I hope are correct!) what should one do with the details returned from the server? Save them to a database?
The docs seem to be a little vague in terms of this particular subject. This is my understanding of the flow:
1) Make payment.
2) Send payment details to server.
3) Get back payment state from server.
4) Check that it's approved and the other details match up (amount, currency etc)
5) Upon making another payment, check to see if the payment id has already been used? This is another part of my confusion.
Thank you in advance for any assistance. Just would like some clarification in layman's terms to see if I understand the flow correctly.
from the sdk you will get a response which will have a state and id. the id you should save to database for your purposes, because you can always call /payments/id https://developer.paypal.com/webapps/developer/docs/api/#look-up-a-payment-resource and see the details of it. Every id is unique. state will have more information if the payment has been successful or not. Please check documentation. Hope it helps.
I'd appreciate any help with this, I've run around in circles trying all sorts of combinations with the PayPal Api - but I'm hitting a brick wall on this one.
I'm looking to call the CreateBillingAgreement method but each time I do it fails and reports a 10001 'internal error' from paypal in the response.
I have a valid token and I'm using version 84.0. I've successfully called SetupExpressCheckout and DoExpressCheckout, both of which succeed and the payment goes through. I'm setting up a future payment / pre-authorisation on the SetupExpressCheckout and the user agrees to that no problems.
Do I need to change settings on the merchant in the sandbox? Am I calling things in the wrong order maybe? (SetExpress, GetExpress, DoExpress, CreateBilling)?
I'm looking to use this billing agreement to allow a reference transaction in the future. I'm having a test account 'pay' using paypal and not forwarding any credit card details, the payment is for a digital service with no delivery (no shipping is set, no addresses or delivery costs are involved). The overall goal is to provide a one-click re-order button, whereby no details need to be entered by the customer.
I'm using the C# api in asp.net 4, or more specifically I've created Service References from the paypal sandbox wsdl and I'm using those in asp.net.
Any and all help is appreciated - thanks.
Russell.
You don't need to call CreateBillingAgreement if you're specifying billingtype MerchantInitiatedBilling in your SetExpressCheckout and DoExpressCheckoutPayment API call. CreateBillingAgreement is only necessary if you don't want to call DoExpressCheckoutPayment.
If MerchantInitiatedBilling is set, DoExpressCheckoutPayment will already return a billing agreement ID, which you can use in DoReferenceTransaction.
I don't have access to an example at hand, but will update this post as soon as I've found one for you.