ExpressCheckout create payment add custom field - paypal

In the old-style html form payment create there was an extra field called custom and I could use it to recognize the payment after Paypal callback. In Rest API when I'm creating a payment in Express Checkout, I want to use it but I don't see that parameter in the documentation. There is a custom field in an IPN simulator but I don't know how to set it in API call.

The custom would go in the transaction object
https://developer.paypal.com/docs/api/payments/v1/#definition-transaction

Unfortunately, the REST API is simply still a long ways behind the Classic API with the features it provides.
For now, if you want to utilize the custom parameter (and many other nice features) you'll need to use the classic Express Checkout API.
If you happen to be working with PHP check out my class library for PayPal. It will make the Express Checkout calls very simple for you.

Rest Api allows you to set one customer field using transaction.custom
Java SDK example in groovy
Transaction transaction = new Transaction()
transaction.amount = new Amount("USD", "100")
transaction.custom = "xyz"
Payment payment = new Payment()
payment.transactions = [transaction]

Related

Integrating PayPal Smart Payment API with old Express Checkout API

We currently have a system in place to process PayPal payments. It is done using the Express Checkout API. The method DoAuthorization accepts a 17 char TransactionID as a parameter.
I'm trying to implement the new PayPal Smart Payment Buttons API. I have the flow programmed with the intent=AUTHORIZE but I can only grab the Authorization ID and Order ID (both 17 char values) from the Auth response once its completed.
When I try and authorize the order and pass one of the 2 values into the DoAuthorization method, returns with an error: TransactionID invalid (10609).
My question is it possible to use the Smart Payments API Authorization ID and Order ID and pass it into the Express Checkout DoAuthorization method and still make the 2 systems work?
Could it be possible that I'm getting the 10609 error because the intent=Authorize already authorizes the order and I need to call the DoCapture method?
It is possible to use the SPB user interface, but not its API (actually it's built on the v2/orders REST API)
You can't mix v2/order API payment setups, with classic captures.
So, so long as you are using classic API calls to capture (this is a very unfortunate requirement that I would advise eliminating ASAP, but it's in your question) -- then, you need to also keep using classic API calls to set up the payment.
See the server demo pattern: https://developer.paypal.com/demo/checkout/#/pattern/server
The createOrder portion will do an XHR fetch to your server, which will then call the classic SetExpressCheckout and return an EC token. SPB will use the classic EC token, but show its new UI.

Passing Item name for PayPal Client-side REST integration

I'm using PayPal Client-side REST integration
https://developer.paypal.com/docs/integration/direct/express-checkout/integration-jsv4/client-side-REST-integration/
and I would like to pass item name together with total and currency.
The item_name is obviously available for standard HTML forms
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/
I'm unable to find a proper way when working with client-side Express Checkout.
The developer documentation will have the information an adding an object and passing the information you're looking for. The document will show the reference for the Payments API along with a sample request.
https://developer.paypal.com/docs/api/payments/#payment

Create paypal form which handles both recurring and one off payments

Wanted to know if paypal allowed this functionality within one form or if I have to create two separate forms in order to obtain this functionality. Currently building a donation widget for a client per their request.
If there are any documentation regarding this within paypal a link would be greatly appreciated.
Cheers.
You can do that no problem. Just build your form with options for one-time or recurring payments, and then use the Express Checkout API to process the checkout accordingly.
If you're working with PHP you can take a look at my class library for PayPal, which will make the Express Checkout API calls very simple for you.
The calls you'd be utilizing are:
SetExpressCheckout
GetExpressCheckoutDetails
DoExpressCheckoutPayment (for one-time payments)
CreateRecurringPaymentsProfile (for subscriptions)

How PayPal Rest API handling payment via Echeck?

I am hosting a service based website. I am allowing the User to pay via Paypal account but I want to restrict the User to pay via Echeck. I believe the classic API has some setting to block check payment but I didn't find anything regarding this in Rest API reference document.
If you're using Express Checkout, you can set PAYMENTREQUEST_0_ALLOWEDPAYMENTMETHOD=InstantPaymentOnly to disable eChecks.
You must set payment options to "IMMEDIATE_PAY". Solution in PayPal JAVA Rest API:
PaymentOptions paymentOptions = new PaymentOptions();
paymentOptions.setAllowedPaymentMethod("IMMEDIATE_PAY");
Transaction transaction = new Transaction();
transaction.setPaymentOptions(paymentOptions);
...
Successfully removes eCheck option without further configuration.

Paypal no BUTTONSOURCE in return URL

I'm trying to integrate booking system everything was fine in posting and other flow. But after paypal payment page and return to my url BUTTONSOURCE was empty.
any suggestion?
Did you include it in both DoExpressCheckoutPayment as well as SetExpressCheckout?
BUTTONSOURCE must be included in both.
Although you'd probably be better off using CUSTOM or INVNUM if you want to use it to link orders on your end together with PayPal transactions.