cashier-paystack
cashier-paystack copied to clipboard
new a little help here
how do I generate the auth_token for a customer before using it to create a subscription, what step should i first take before i use the newSubscription->create(...,...) method
A little late. If you setup webhooks and you are using the client JavaScript popup option for payment, anytime there's a new subscription from the frontend the auth token is always available in the new subscription webhook event data. So you can pick it up from there and create your subscription without charging since it's already charged by paystack.
This is a sample from the event data:
...
"authorization": {
"authorization_code": "AUTH_isdzt7wx1h",
"bin": "408408",
"last4": "4081",
"exp_month": "12",
"exp_year": "2020",
"channel": "card",
"card_type": "visa ",
"bank": "TEST BANK",
"country_code": "GH",
"brand": "visa",
"reusable": true,
"signature": "SIG_JuApWkGTvBz2AgztRLO9",
"account_name": null
}