Create Order > Is the PayPal-Request-Id mandatory?

no_clue
Contributor
Contributor

Dear Helpers,

when I create an order and don't send the PayPal-Request-Id in the Header, I get the error:
"400 Bad Request"

 

Isn't the PayPal-Request-Id optional? 

Login to Me Too
2 REPLIES 2

MTS_Chiranjeevi
Moderator
Moderator

Good day @no_clue,

 

Thank you for posting to the PayPal community.

 

PayPal-Request-Id :  Optional. Contains a unique user-generated ID that the server stores for a period of time. Use this header to enforce idempotency on REST API POST calls. You can make these calls any number of times without concern that the server creates or completes an action on a resource more than once. You can retry calls that fail with network timeouts or the HTTP 500 status code. You can retry calls for as long as the server stores the ID.

For example, a user calls refund captured payment with the PayPal-Request-Id header that contains a unique user-provided ID. The user can make the call again with the same ID in the PayPal-Request-Id header for up to 45 days because the server stores this ID for this long for this call.

 

If the initial call fails with the HTTP 500 status code but the server has already refunded the payment, the caller does not need to worry that the server will refund the payment again.

 

Note: Not all APIs support this header. To determine whether your API supports it and for information about how long the server stores the ID, see the reference for your API.

 

https://developer.paypal.com/api/rest/requests/#http-request-headers 

 

Please pass the "PayPal-Request-Id" in the HEADER PARAMETERS during the Create Order API call. 

 

https://developer.paypal.com/docs/api/orders/v2/#orders_create!in=header&path=PayPal-Request-Id&t=re... 

 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

no_clue
Contributor
Contributor

@MTS_Chiranjeevi  

Thank you very much for your answer.

 

So, for "Create Order" it is not optional? The request does not work without it.

Login to Me Too

Haven't Found your Answer?

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