andela-sjames / paystack-python

Python plugin for Paystack
https://pypi.python.org/pypi/paystackapi
MIT License
107 stars 43 forks source link

Abandoned Status For Transaction #46

Closed spaceofmiah closed 5 years ago

spaceofmiah commented 5 years ago

I keep getting abandoned status for my transactions, i have followed the steps provided in api docs and also from paystack support team, but in one way or the other, every of my transactions are abandoned... These are the steps that i followed

paystack = Paystack(settings.PAYSTACK_TEST_SK)       # register my secret_key

# metadata to be passed to paystackapi
metadata = {
        "card": {
            "cvv":card_cvv,
            "number":card_number,
            "expiry_month":exp_m,
            "expiry_year":exp_y,
       }
 }

# initialize transaction using paystackapi
init_response = Transaction.initialize(
            callback_url=callback_url_route,
            reference=reference_id,
            email=order.ordered_by.email,
            amount=amount,
            metadata=metadata
 )

# the initialization returns a response containing the authorization url
# which according to paystack support team, i should redirect to 
HttpResponseRedirect(authorization_url_from_init_response)   # Django HttpResponseRedirect

# verify transaction using paystackapi
transaction_verifier = Transaction.verify(reference_id)

### which returns abandoned status for transaction 

i don't know if i'm doing it correctly (i.e if my steps are right ) i am not getting any error from either paystack nor my server, please any help will be highly appreciated. Thanks in anticipation

spaceofmiah commented 5 years ago

I'm sorry for this, i didn't actually understand paystack flow, but now i do. I tried reinventing the checkout page, which is supposed to be handled by paystack after i redirect to the authorization_url. This has been fixed and thank you for your library.