cancel
Showing results for 
Search instead for 
Did you mean: 

Partially order authorization and capture

Options
Go to solution
willindzz
Contributor
Posted on

I am building an web app allow my client to partially authorize and capture an order.
As I know, Paypal does support this feature. (source: https://developer.paypal.com/docs/admin/auth-capture/#)

 

My use case is like the following:
1. Customer places an order in my client website and approve the order.
2. My client check the stock of items in the order. My client will only authorize and capture the amount which those item is currently in stock.
3. After capturing, my client will send out the items which is in stock now
4. If the remaining items are available within 29 days, my client will capture the remaining amount of the order and send out the remaining items.
5. If the remaining are not available in the following 29 days, my client will void the remaining part of the order.

 

e.g. There is two items in the customer's order(Total amount: $800), A($500) and B($300). If only item A is in stock now, my client would like capture $500 first and delivery item A to customer. If item B is available in the future, my client capture the remaining $300 and send out item B.

What I want to know is that whether this feature is supported in REST API?


From this link: https://developer.paypal.com/docs/integration/direct/payments/orders/#execute-order
In the tutorial, I notice that I am allowed to pass amount to the v1 order authorize api.
However, in the v2 order authorize api (https://developer.paypal.com/docs/api/orders/v2/#orders_authorize) is only allow me to authorize the whole order but not partially authorization.

 

If this feature does not supported in REST API, can anyone provide more information to guide me how I can achieve the functions that I described above.

Thanks a lot!

1 ACCEPTED SOLUTION

Accepted Solutions
Solved

Partially order authorization and capture

Options
Go to solution
MTS_Andre
Moderator

Hi Willindzz, yes you can get this scenario working:

 

Call the v2 Order API with an intent of AUTHORIZE
Ref.

Example:
{
  "intent": "AUTHORIZE",
  "application_context": {
  "return_url": "https://myReturnURL.com",
  "cancel_url": "https://myCancelURL.com",
  "brand_name": "My Shop Name",
  "locale": "en-US",
  "landing_page": "LOGIN",
  "user_action": "CONTINUE"
},
"purchase_units": [
{
"amount": {
  "currency_code": "USD",
  "value": "500.00",
},
"item_total": {
"currency_code": "USD",

...

...

...

 

 

Call the approve link returne into the API response so that the buyer will be redirected to the PayPal checkout page and will authorize the order:
"href": "https://www.paypal.com/checkoutnow?token=8YL60405GN0650213",
"rel": "approve",
"method": "GET"


Call POST /v2/checkout/orders/8YL60405GN0650213/authorize in order to get the authorization ID
Ref.


You will get "authorizations": [
"status": "CREATED",
"id": "6HV03080SC429193M"


Call the payment API: v2/payments/authorizations/6HV03080SC429193M/capture
Ref.

As you can read in the reference above you can "capture a portion of the full authorized amount. If amount is not specified, the full authorized amount is captured". And also you can use this variable:

final_capture
Indicates whether you can make additional captures against the authorized payment. Set to TRUE if you do not intend to capture additional payments against the authorization. Set to FALSE if you intend to capture additional payments against the authorization.

View solution in original post

1 REPLY 1
Solved

Partially order authorization and capture

Options
Go to solution
MTS_Andre
Moderator

Hi Willindzz, yes you can get this scenario working:

 

Call the v2 Order API with an intent of AUTHORIZE
Ref.

Example:
{
  "intent": "AUTHORIZE",
  "application_context": {
  "return_url": "https://myReturnURL.com",
  "cancel_url": "https://myCancelURL.com",
  "brand_name": "My Shop Name",
  "locale": "en-US",
  "landing_page": "LOGIN",
  "user_action": "CONTINUE"
},
"purchase_units": [
{
"amount": {
  "currency_code": "USD",
  "value": "500.00",
},
"item_total": {
"currency_code": "USD",

...

...

...

 

 

Call the approve link returne into the API response so that the buyer will be redirected to the PayPal checkout page and will authorize the order:
"href": "https://www.paypal.com/checkoutnow?token=8YL60405GN0650213",
"rel": "approve",
"method": "GET"


Call POST /v2/checkout/orders/8YL60405GN0650213/authorize in order to get the authorization ID
Ref.


You will get "authorizations": [
"status": "CREATED",
"id": "6HV03080SC429193M"


Call the payment API: v2/payments/authorizations/6HV03080SC429193M/capture
Ref.

As you can read in the reference above you can "capture a portion of the full authorized amount. If amount is not specified, the full authorized amount is captured". And also you can use this variable:

final_capture
Indicates whether you can make additional captures against the authorized payment. Set to TRUE if you do not intend to capture additional payments against the authorization. Set to FALSE if you intend to capture additional payments against the authorization.

View solution in original post

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.