Closed greeninho closed 5 years ago
@greeninho few things could be going on, to make sure we better help you with your integration please email us at sales-engineering@bitpay.com the parameters you are sending to the API when creating an invoice. Are you on test or production, and are you using a modal invoice or our hosted invoice? Thank you.
Cheers, DDE
@danescsvn I have just sent an email to the address you mentioned with a screenshot of some source codes and how to replicate the issue
@danescsvn I am yet to get a response to my email
Did you email us? I'm not seeing an email from you. Please also try support@bitpay.com. Thank you.
On Sat, Apr 13, 2019, 5:15 AM Green Onyeji notifications@github.com wrote:
@danescsvn https://github.com/danescsvn I am yet to get a response to my email
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bitpay/php-bitpay-client/issues/290#issuecomment-482792434, or mute the thread https://github.com/notifications/unsubscribe-auth/AQQrn-HTe9tN8M_rupJsHJhdXnJazXieks5vgaBAgaJpZM4csLLn .
@danescsvn sent to support@bitpay.com
For those having this problem, to solve this according to their support team
add this code snippets in your javascript
var payment_status = null; var is_paid = false window.addEventListener("message", function(event) { payment_status = event.data.status; console.log('event.data',event) if(payment_status === 'paid' || payment_status === 'confirmed' || payment_status === 'complete'){ is_paid = true; } }, false);
then for All done action in the Bitpay success page add this after the above code
bitpay.onModalWillLeave(function() { if (is_paid == true) { //do your redirect here } });
FYI, the entire code block would look like
var payment_status = null;
var is_paid = false
window.addEventListener("message", function(event) {
payment_status = event.data.status;
if(payment_status == 'paid'){
is_paid = true
}
}, false);
bitpay.onModalWillEnter(function() {
//add any custom code for when the invoice is loading
});
bitpay.onModalWillLeave(function() {
if (is_paid == true) {
//redirect code goes here
}
});
I have been having this strange occurrence of late (1 day ago) using bitpay php, I decided to set my transaction speed to high in order to immediately verify the payment status. This returns "confirmed" as the payment status of the transaction immediately after the transaction goes through but fails to redirect URL as set in my invoice object when I click on the done button in the success page of bitpay. But after sometimes or immediately I query the invoice using the invoice URL, it redirects well. What could be the cause?