How to select payin3 as default payment method using rest api in paypal - paypal

I want if my customer clicks a customised payin3 button from my site he redirects to paypal page where payin3 should be selected rather than paypal balance by using rest apis what should I do?
Here is my code which is not achieving that requirements.
{
"intent":"CAPTURE",
"purchase_units":[
{
"reference_id":"58Y18137NX645002L",
"amount":{
"currency_code":"GBP",
"value":"120.00"
}
}
],
"payment_source":{
"paypal":{
"experience_context":{
"payment_method_preference":"IMMEDIATE_PAYMENT_REQUIRED",
"payment_method_selected":"PAYLATER",
"brand_name":"EXAMPLE INC",
"landing_page":"LOGIN",
"shipping_preference":"SET_PROVIDED_ADDRESS",
"user_action":"PAY_NOW",
"return_url":"https://example.com/returnUrl",
"cancel_url":"https://example.com/cancelUrl"
}
}
}
}

The necessary value is:
"payment_method_selected":"PAYPAL_PAY_LATER",
The behavior of the PayPal page after login may vary in sandbox, and in live according to whatever the signed-in payer account has available to it. Pay Later may or may not show and may or may not be the default, but as far as requesting it show if possible this parameter is all you need to do. There is nothing else.
Ultimately, the payer can always select a different funding source within a PayPal.com checkout, and all payments will look the same to the receiver account (simply a "PayPal" payment) whether or not Pay Later was actually used. Any use of Pay Later or PayPal Credit is between the payer and PayPal, and kept private the same as any other funding source selection (Balance, Card, Bank, whatever)

Related

Add shipping cost after user authorizes PayPal payment

I'm using PayPal Checkout, which isn't well-documented but doesn't support automatically adding shipping costs in the account dashboard as far as I can tell. I need to charge users different amounts for shipping depending on their location, which I don't receive from PayPal until the user authorizes a payment. Without re-authorizing, how can I charge an additional fee for shipping? I saw this behavior implemented on this site recently while making a purchase – I authorized a payment using what appears to be PayPal Checkout, after which I was able to select a shipping method (some of which cost up to $30 extra) and it seemed I was able to complete my payment without reauthorizing.
I haven't found anything in the PayPal Checkout documentation or by inspecting the object passed into onAuthorize that seems to expose this functionality. I did find a PATCH /payments/payment/{id} endpoint in the docs for the Payments API, but I have no idea how to access this from the PayPal Checkout flow on my website, nor whether my site is considered a "Third Party Provider in the context of PSD2 regulation."
How can I add a shipping cost to a payment after authorization using PayPal Checkout?
You can find more required info here :https://developer.paypal.com/docs/checkout/integration-features/shipping-callback
paypal.Buttons({
onShippingChange: function(data, actions) {
console(data);
}
}).render('#paypal-button-container');

express checkout with html info without API calls?

Can I improve user experience, e.g. show product description, and highlight "Pay using your credit card", with simple Paypal buttons?
I offer a paid service on my website, with monthly subscription, fixed amount each month. I don't need the user's address, and there's only 1 "product".
Currently I created a simple "paypal button", which works fine, but I want to improve it, and possibly make it even shorter, but didn't find out how to:
highlight "pay with credit card",
I don't want to force users into logging into their paypal account (users with paypal account get error: "You cannot use an e-mail address or card number that belongs to an existing PayPal account")
show the user the product details/descriptions as in the picture:
Although I'm a programmer, I prefer not to use any API calls, especially since it doesn't seem to be necessary in my simple case.
How can I add these elements?
Is there an option with paypal to send users directly to a credit-card payment screen?
You'll need to switch to the Express Checkout API to show item details and force the credit card option. Even then, though, if the user has the credit card added to a PayPal account they're going to have to sign in and pay that way rather than use the CC form. Also, if you're working with recurring payments they'll need a PayPal account anyway.
The only way to avoid that is to sign up for PayPal Payments Pro so you can tie the credit card form directly into your website with no redirect to PayPal at all.
You'll need to enable Recurring Billing on Pro, too, after it's approved and enabled, and then your users can choose to sign up with PayPal (where you'd use Express Checkout) or Pro (where they'd enter a credit card directly.)
If you're really that set on not using API's you could apply for Enhanced Recurring Payments for Payments Standard, but I haven't fully tested that to see about passing order item details to the review pages.

PayPal API - How to keep the payment process on my website?

I run a small marketplace with multiple sellers where buyers can buy items and pay with PayPal. The problem is, when someone makes a payment, they are then displayed the "Payment Confirmation" on the PayPal website and are given a choice to either return to their PayPal account, or return to the website.
Is there any way to keep the payment flow on my website, except for the payment part? I notice when buying on Etsy for example, the buyer goes to PayPal to make the payment and is then immediately returned to Etsy for the payment confirmation. They never see the PayPal payment confirmation page.
I assume it could be because Etsy and PayPal have a special arrangement that isn't available to other sites? Or am I missing something in the API?
Right now, with the normal PayPal API, this is what buyers see:
NAME, you've just completed your payment.
Your transaction ID for this payment is: XXXXXXXXXXXXXXXXXXXX.
We'll send a confirmation email to your#email.com
Go to PayPal account overview.
Go back to "seller#email.com".
I can't even figure out how to change the "Go back to..." link to my website name in the hidden fields. PayPal just chooses to display the seller's (the person that received the payment) email address.
Is there any way to at least set a website name for them to return to with hidden variables? Keep in mind that I have different sellers, so it's not something I could set inside each seller's PayPal account.
Thank you :)
I assume you are using Express Checkout with Set/Get/Do EC API integration. Please check the below document for experience options available with Express Checkout API.
https://developer.paypal.com/webapps/developer/docs/classic/express-checkout/integration-guide/ECCustomizing/
The 'useraction=commit' in the PayPal payment auth url triigers the 'Buy' button. If you do not send that request paramter then it will show 'continue' button and you can complete rest of the process on your site.
However, if you are using Paypal Payment Standard product then you need to use Express Checkout to accomplish the outcome you are seeking.

Auto Return Not Working In PayPal Pro Hosted Solution?

I am using the new PayPal Pro Hosted Solution on a new site, and all seems to work 'OK' apart from auto return does not work?
I have auto return enabled in my paypal account along with IPN and payment data as I have the auto return working with normal Paypal on my old site (So I know its setup correctly). And I have all the correct fields INCLUDING the 'return' variable set and sent to PayPal on this pro-hosted form.
After successful payment I just get the standard Paypal pro hosted thank you page (There is no delay redirect, I left it on the page for over a minute)??? There is a return link on the page, which if pressed returns me to the correct page.
BUT I need the users auto returned? Or this solution is useless to me as I won't be able to track conversions? I can't be the only person needing this surely?
I solved this. it IS possible with credit cards and PayPal. Just make sure you add the following variables
return with your return url in it
showHostedThankyouPage with a value of false
Was the buyer paying with their PayPal account or credit card. With Auto Return, the buyer is automatically returned when the buyer pays with their PayPal account, however if the buyer pays with their credit card they are not automatically redirected. They are given time to write the information down or print the page. Unlike someone that pays with their PayPal account, they can not always get back to the transaction details. The buyer that pays with a credit card will have to click the link to return back to the merchants site. This is why it is better to rely on IPN than auto return. IPN will take place regardless if the buyer returns to your site.

Paypal REST API Adaptive / Multiple Payments (change payee)

I've just started looking at Paypal's REST api. One thing I can't seem to see is a feature paypal call Adaptive Payments. This allows me to register my app with my developer account, but not be involved in the actual payments. e.g. my app allows my users to accept payment for their services, which they sell through my app.
I have been through Paypals REST API documents. I have worked out how to complete a payment, but all the transactions get sent through to my developer paypal account. I can't find where i would change the receiver details, i.e. the seller, to allow payments to be sent to a different paypal account.
Ok, after some extensive googling, I managed to find the answer here
This general model enables us to easily add support for variety of payment models in the future (Parallel, Chained, etc). The Payee could be a funding instrument (like a Credit/Debit Card,) or a PayPal account (wallet) itself. The Payee could be set explicitly if the Payee is not the same as the Payment Facilitator ( in this current release we only support the case where the Payee is same as the Facilitator) so this is not currently required.
So looks like a payee is just added to the transactions array, but this is not currently implemented as of the date of this answer.
As of January 3rd 2017, PayPal has now added the ability to set the payee to anyone you wish.
Notice the new payee object below:
{
'intent':'sale',
'redirect_urls':{
'return_url':'http://localhost:3000/process',
'cancel_url':'http://localhost:3000/cancel'
},
'payer':{
'payment_method':'paypal'
},
'transactions':[{
'amount':{
'total':'10',
'currency':'USD'
},
'payee':{
'email': 'payee#test.com'
},
'description':'My amazing product'
}]
}
However, there doesn't seem to be an ability to have multiple payee's.
Additional info here: https://devblog.paypal.com/setting-payee/