I have the following flow -
A buyer makes a payment, I add a customer payee on the client, pass the orderId to the server and capture the transaction on the server.
Can I do a refund in this case?
using the following API I get "PERMISSION_DENIED"
https://api.sandbox.paypal.com/v2/payments/captures/0NA021645B5069646/refund
description: "You do not have permission to access or perform operations on this resource."
What am I doing wrong?
You don't have permission to refund payments from someone else's account.
They need to grant the permission to your API caller account.
Once granted, for that particular v2 refund call you'll need to construct and pass a PayPal-Auth-Assertion header, documented here: https://developer.paypal.com/docs/api/reference/api-requests/#http-request-headers
Related
I'm trying to make refunds for adaptive payments and I get following Error in response: 'NO_API_ACCESS_TO_RECEIVER'
On this page
https://developer.paypal.com/docs/classic/api/adaptive-payments/Refund_API_Operation/
in documentation exists link to Grant API permission, but looks like it obsolete, and I can't find any other information how to enable refunds, has anyone resolved this issue?
The receiver must provide you (primary receiver) access to the refund API. The PayPal document clearly states the following:
Have made a Pay request for which payment you want to refund the
payment, or you must have received the part of the payment you want to
refund, and
Have permission to make a refund on behalf of the receiver, unless you
are also the receiver; in other words, each receiver whose account is
the source of the refund must have granted you third-party access
permission to call the Refund API operation.
I have setup PayPal Sandbox test accounts, a Personal (buyer) and a Business (merchant).
I'd like to test a PayPal 'DoCapture' API Operation. The problem I'm encountering is that I need an AuthorizationID and don't know how to obtain it. If i run the 'DoExpressCheckoutPayment' API call, I do not get an AuthorizationID returned, using the merchant API credentials, though I do get an 'ACK' of success. Do I need to be using the buyer credentials with the 'DoExpressCheckOutPayment' call? I don't see the API credentials in the PayPal Sandbox profile for the Personal account.
Express Checkout example with authorization and capturing you can find here.
Short answer - according with DoCapture documentation
AuthorizationID ... This is the transaction ID returned from DoExpressCheckoutPayment...
According with DoExpressCheckout documentation you need field from response, attention, PaymentInfo#TransactionId
... this value is your AuthorizationID for use with the Authorization & Capture APIs.
This is what you need to do to implement the capture API.
Create Payment: set intent as authorize in its request to get payment Id
Show Payment Details: to get approval_url. The customer will use this URL to pay for the order.
Execute approved PayPal payment: Use this API after customer successfully pays for the order. This API returns authorization-id along with capture link.
Use Capture API: use the URL obtained from step 3 to capture.
Use this link and check payments API.
https://developer.paypal.com/docs/api/payments/#payment_execute
Hope this helps to someone who stumbles upon here.
Can you help me. I need to know if PayPal has an API call to get subscription details like the enddate of the subscription?
I do the request to PayPal and get the response,
SUCCESS
transaction_subject=Name20
payment_date=10%3A42%3A50+Mar+28%2C+2014+PDT
txn_type=subscr_payment
subscr_id=I-MWMMATTBSY2M
last_name=jls
....
but I need details from suscription as enddate.
Sounds like you're using Standard Subscriptions and the "response" you're referring to would be an Instant Payment Notification (IPN)..??
Unfortunately, the standard subscriptions system doesn't have any API's to access details directly. You could switch to Express Checkout and the Recurring Payments API, though, and this would give you access to API's to obtain details and manage the profiles programatically.
If you're working with PHP you can setup Express Checkout and Recurring Payments very easily using my class library for PayPal.
The flow you'll be setting up would be as follows...
1) Call SetExpressCheckout to obtain a token and redirect the user to PayPal. The SEC request will also include a ReturnURL which is where PayPal sends the user after they've signed in and agreed to continue. You also need to make sure to include the Billing Agreement parameters in your SEC request so that the token you get will be compatible with recurring payments.
2) The user ends up back at your ReturnURL, and this is where you'll call GetExpressCheckoutDetails to obtain details about the buyer that the system now knows since they've signed in. This gives you info like the payer's name, email, address, etc. It also gives you the Payer ID you'll need for the final request.
3) Right after obtaining the details via GECD you'll call CreateRecurringPaymentsProfile to finalize the subscription profile creation.
I am a API caller (in adaptive payment), I want to verify if a given email address has granted the API permission to
process the Refund API off their account.
It would be nice to have an API call to check this.
Thanks
Use Permissions API which will allow you to explicitly set the third-party API grant and check it.
Is there an ability to verify if the the user has a valid email address linked to the PayPal account
and also if possible to check if this account has Grant API permission (toward my account) to process Refund API?
Profile to refund is Payment profile is created through AdaptivePayment Pay API call.
I was wondering if this is possible through an API call?
Thanks
You can use PayPal GetVerifiedStatus API Operation will check for the verified status of the paypal account. You can also use Permissions API Operation to explicitly get/check the permissions granted for the specific PayPal account.