I have customers signing up for a 12 monthly installment option. I need to know if their credit card will be valid for at least the duration of the installment option exactly 12 months.
Using the card.exp_year
and card.exp_month
from the object received below, how would I work out if this credit card will be valid exactly 1 year from now. I assume I have to use the Date()
function.
{
"id": "tok_xxxxxxxx",
"object": "token",
"card": {
"id": "card_xxxxxxxx",
"object": "card",
"address_city": null,
"address_country": "BE",
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": null,
"address_zip_check": null,
"brand": "Visa",
"country": "CA",
"cvc_check": "unchecked",
"dynamic_last4": null,
"exp_month": 7,
"exp_year": 2019,
"funding": "credit",
"last4": "3086",
"metadata": {},
"name": "John Doe ",
"tokenization_method": null
},
"client_ip": "149.xxx.xxx.xxx",
"created": 1530xxxxxx,
"livemode": true,
"type": "card",
"used": false
}