Why does the PayPal API sandbox environment return different states for create payment?
When creating a payment using the PayPal REST API's Sandbox environment, the response includes a state property of either: created or approved. This is true even with the same request payload, using the same test credit card. Whereas in the Live environment, the response's state property is consistently approved on success. The endpoint being used is POST /v1/payments/payment. Since we're using the PayPal REST API to process credit cards directly, and never sending users to paypal.com, the state property should always return approved or failed per the documentation.
According to PayPal's technical support: I have consult our senior engineer and below are the justification. The reason why you are seeing sometime state = created or approved because that is the nature of a sandbox. In Live account, the state result constantly show as approve because it is already validate by the bank. Whereby, in sandbox it is not validate because we are using a fake credit card and that is the reason why we are responding inconsistence result of created or approved. This is to cater the result of both situation from the Live account. This happen since the fake credit card was not been approved in by the bank due to testing purposes. I hope this justify the issue. In a nutshell: PayPal's Sandbox environment intentionally returns a random value for state, even though the value may not make sense for your app's payment flow.
Paypal API - Can we transfer money to multiple accounts in a transaction?
Paypal Button JS plugin : Testing in sandbox
Paypal payment is successufly completed in prestashop however the result message says error
How to create a PayPal developer account for ebay testshop (Germany)
PayPal - OAuth2 API Access?
Auto-Return to Site After Payment
Credit card payment without address line 1, city, and state?
Paypal sandbox redirect to homepage for Safari
I can't pay with Paypal through WooCommerce
Custom Payment IPN notify_url
Do I need IPN for processing preapproved payments?
How do I take 10% fee of paypal trasaction
PayPal Auto Return not working
PayPal ipn notification request not sending
Can Paypal Payments Standard accept a value and pass it along to the webpage users are redirected to after successful payment?
How to enable internet banking payment method for my PayPal sandbox account?