Embedded Payment : How to get pay key to process preapproval - paypal

According to Paypal Adaptive Payment :
For Preapproval request we need a endpoint call (1 , mentioned below) , works ok, but not mobile friendly
End Point
1) https://www.paypal.com/cgi-bin/webscr?cmd=_ap-preapproval&preapprovalkey=value
needed to preapproval request.
End Point (Embed Payment)
2) https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=value&preapprovalkey=value
This case needed paykey , which is required , but preapproval request dont need paykey , How could i call this 2) end point with just preapproval key Like endpoint 1)
Thanks in Advanced

You would make a call to the Pay API to obtain a pay key.

Related

Set shipping address in PayPal Adaptive Payment call (chained and regular)

I would like to activate the seller protection option, this requires me to send over the shipping address the buyer has filled in on my website.
I have 2 scenarios: with 1 receiver and with no receivers.
I know that I need to use the SetPaymentOptions API call but I couldn't a way to pass the PAY or PAY_PRIMARY option I have in the PAY API.
Is it possible to pass shipping address with chained payments?
Please let me know what am I missing.
Thanks
Setup chained payment with shipping address, this can be implemented if you integrate chained payment by using embeded flow. This is the steps for you to follow to display and collect the selected shipping address
Call the Pay API operation with actionType set to CREATE to obtain a payment key.
Set senderOptions.requireShippingAddressSelection to true in your request to SetPaymentOptions and call the API operation.
Redirect the payment sender's browser to the embedded payment flow at https://www.paypal.com/webapps/adaptivepayment/flow/pay?paykey=... after obtaining the pay key.
After returning from the flow, call the GetShippingAddresses API operation to obtain the selected shipping address.
Note: This step assume that you have implemented the JavaScript for invoking the embedded payment flow, that you have set up your button or form to invoke the flow, and that you have included the code to close the window associated with the flow.
For more information, here is the reference link for you:
Adaptive payment : https://developer.paypal.com/docs/classic/adaptive-payments/integration-guide/APIntro/
Pay API : https://developer.paypal.com/docs/classic/api/adaptive-payments/Pay_API_Operation/
SetPaymentOptions API : https://developer.paypal.com/docs/classic/api/adaptive-payments/SetPaymentOptions_API_Operation/
Hope these could be helpful.

Pay payments in paypal without direct Login

i am new to paypal , my client need to pay the payment in the date which was set by
the admin , is it possible to do this using cron . is any method is there in paypal . i
search in google but i didn't find the answer . using key with user name password can we able
to do it in cron job itself . or else in the recurring payment method able to update the payment dates . help me to do it
Thanks
Take a look at the Adaptive Payments API, specifically Preapproval and Pay.
You can Preapproval to generate a preapproval key. The payer signs in to authenticate and create this preapproval profile.
Once the profile has been created you can use the Pay API with the preapproval key included to submit future payments on that person's behalf without the need for any further authentication. This allows you to fully automate payments on whatever date for whatever amount you need.

Auth / Capture using Adaptive Payment of Paypal?

Is it possible to do authorization and capture using Adaptive Payment of Paypal ? How ?
Sort of, but it's not really the same. What you would do is use the Preapproval API to create a preapproval profile for the payer(s) using your app. Then you can pass the preapproval key that you get back into future Pay API calls to submit payments on their behalf without further approval.
Setting up the preapproval would be similar to authorization a payment, and then running the pay call to trigger a payment would be similar to capturing.
This guide on setting up preapproval profiles should help you understand how it all works.
Also please keep in mind:
The preapproved maximum total amount of all payments cannot exceed
$2,000 USD or the equivalent in other currencies.

Paypal recurring + purchase

After looking through Paypal docs for a solution for this circumstance, I came up blank. What I want is a way to have a shopping cart with a subscription (recurring payment) and an item purchase. Is there a method that would resolve this or would I have to do something custom ( and how would I go about that if I'm using Paypal standard buttons for cart / checkout ).
Thanks in advance.
Yes, you can do this with Express Checkout Recurring Payments.
You would simply need to ensure you include an AMT in your SetExpressCheckout and DoExpressCheckoutPayment API calls.
A general Express Checkout checkout flow is based on three API calls; SetExpressCheckout, GetExpressCheckoutDetails and DoExpressCheckoutPayment.
SetExpressCheckout sets up the payment and returns a token
You redirect the buyer to https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=TOKEN-HERE, where TOKEN-HERE is the token you received earlier
After the buyer has agreed to the payment, he is returned back to your site.
You can call GetExpressCheckoutDetails and supply the token as a parameter to get the PAYERID of the buyer.
Call DoExpressCheckoutPayment with the token and PAYERID supplied to finalize the payment
If you wish to use Recurring Payments, you would use the following flow:
1. Call SetExpressCheckout and set BILLINGTYPE to 'RecurringPayments' and set 'AMT' to 0 OR to any amount you wish to charge the buyer immediately. .
2. Retrieve the token from the API response for SetExpressCheckout
3. Call DoExpressCheckoutPayment and set the 'AMT' to the amount you'd like to charge immediately.
4. Call CreateRecurringPaymentsProfile and supply the token, specify all other required parameters (billingfrequency, among others).
(Optional) 5. Use UpdateRecurringPaymentsProfile if you wish to update your recurring payments profile..
You can find additional documentation for Express Checkout at https://www.x.com/community/ppx/documentation#ec as well as our SDK's at https://www.x.com/community/ppx/sdks#NVP
You can find an overview with links to the relevant API documentation for SetExpressCheckout, DoExpressCheckoutPayment, CreateRecurringPaymentsProfile and UpdateRecurringPaymentsProfile at https://www.x.com/docs/DOC-1372

Workflow with PayKey using Paypal Adaptive Payment

I'm trying to implement a payment system using the new Paypal API (Adaptive Payment).
So far, I have this workflow :
Send a request to Paypal for : AdaptivePayments/Pay
This create a Pay request, and return a payKey that is valid 3 hours (source)
Now, I wait that paypal sends me request throught the IPN. When it will, I will get the pay_key with it
Using this pay_key, I will call the AdaptivePayments/PaymentDetails to know the state of the payment.
But I was wondering, how can I do if it's been more than 3 hours? (like in a refund?)
What is the sure way to do then?
Thanks for your help!
Well I'll answer myself on that one and after a bit of reading.
Instead of using the payKey given when calling AdaptivePayments/Pay, and other solution is to use the trackingId.
Here's how :
First step, you create an AdaptivePayments/Pay and you specify a trackingId (must be unique) :
{
"actionType":"PAY",
"currencyCode":"USD",
"receiverList":{"receiver":[{"amount":"1.00","email":"seller_1288085303_biz#gmail.com"}]},
"returnUrl":"http://apigee.com/console/-1/handlePaypalReturn",
"cancelUrl":"http://apigee.com/console/-1/handlePaypalCancel?",
"trackingId":"abcde-12345-unique-of-course",
"ipnNotificationUrl":"http://apigee.com/console/-1/ipn",
"requestEnvelope":{"errorLanguage":"en_US", "detailLevel":"ReturnAll"}
}
In response, you will have the payKey that you'll redirect your buyer to, in order to do the payment.
Then, for the whole evolution of this payment, you will be notified to your IPN url (here, "http://apigee.com/console/-1/ipn").
When you'll receive a (POST) request at this adress, check the validity to paypal and you'll get a trackingId in the parameter. Check that this trackingId exists and then ask AdaptivePayments/PaymentDetails with that trackingId like this :
{
"trackingId":"{put here}",
"requestEnvelope":{"errorLanguage":"en_US", "detailLevel":"ReturnAll"}
}
And you will have a complete detailled status of your payment in return.
Now, you do the work to update your database, call your buyer, etc etc :)
What was helpful for me :
Pay API Operation
PaymentDetails API Operation
IPN Variable Reference
Apigee Paypal console