I live in Hong Kong and I always get this sandbox paypal transaction error after midnight from paypal.billingAgreement.execute()
. The error goes away in the afternoon, probably because the place where paypal server is located finally gets past the midnight.
{ name: 'SUBSCRIPTION_UNMAPPED_ERROR',
message: 'Subscription start date should be greater than current date',
information_link: 'https://developer.paypal.com/docs/api/payments.billing-agreements#errors',
debug_id: 'd2e618eef4162',
httpStatusCode: 400
},
I know this is a timezone problem with the sandbox environment but I can't figure out how to solve it.
My billing agreement is created as per the example in PayPal-node-SDK
process.env.TZ = 'utc';
var isoDate = new Date();
isoDate.setSeconds(isoDate.getSeconds() + 4);
isoDate.toISOString().slice(0, 19) + 'Z';
var billingAgreementAttributes = {
"start_date": isoDate,
/..../
}
I have set the TZ
environment variable in nodes to utc
;
The time zone setting of the sandbox account I use to log in and subscribe:
I've also tried different zones like Eastern Time
but it has no effects.
As per PayPal Docs, StartDate should be UTC, looks Setting Process Time Zone
process.env.TZ = 'utc';
has no effect in your code(some time it might be cashed), can you check the date variable value is in UTC?
I would suggest to change
var isoDate = new Date();
to
var isoDate = new Date().toISOString();
Hope it helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With