paddle-php-sdk
paddle-php-sdk copied to clipboard
Paddle Transaction Status - Client vs. Server (Sandbox)
Describe the bug
Im using PaddleJS in Frontend and store the current Userrequest in Backend (SPA - Approach), by validating the Transaction_ID. I realized I get different kind of Transaction Status by Paddle, when Client returns Status "Completed".
- Client - Paddle JS => response: { status: "completed" }
- Server - API Request "https://sandbox-api.paddle.com/transactions/{transaction_id}" => response: { status: "paid" }
Steps to reproduce
- Client: Paddle JS Process Checkout
- Client -> Server Request: Each Response will be sent to Backend via API Call
- Server: Validate Client Request by Paddle Request "https://sandbox-api.paddle.com/transactions/{transaction_id}"
Expected behavior
Response from Client & Server should have the same Status and according attributes
Code snippets
// Client Request
// As soon we get Paddle Callback, Serverrequest is starting
const paddleInstance = await initializePaddle({
environment: 'sandbox',
token: props['publicKey'],
eventCallback: function(data) {
context.emit('paddleEvents', data)
}
});
// Server Request (PHP)
// Validate Client Request
$this->client = new Client([
'verify' => (bool) env('PADDLE_SANDBOX') ? false : true,
'base_uri' => env('PADDLE_URL'),
]);
$response = $this->client->request('GET', 'transactions/' . $transactionID, [
'headers' => [
'Authorization' => 'Bearer ' . $this->paddle_api_key
],
]);
PHP version
PHP 8.1
SDK version
paddle
API version
Paddle Version 1
Additional context
Its not directly correlated to https://github.com/PaddleHQ/paddle-php-sdk, but may you can help me, or you also faced this issue?
Hi @CarlsonBuma, Thank you for raising this issue.
It appears that you are comparing status of two different entities (checkout and transactions).
The completed
status returned by PaddleJS during the checkout.completed
event means the checkout is complete and payment is collected successfully. At this point, the transaction entity behind the checkout will be at paid
state.
Once the transaction is paid, there are some asynchronous process running in the background before a transaction reaches completed
state.
Please let us know if you need any more information.
Hi @CarlsonBuma closing this issue as it seems it got clarified by @vijayasingam-paddle, feel free to open a new one if something else comes up.
Thank you.