The challenge I am having is it keeps adding values when I try to test it in live
I have processed for a dollar but if I cancel and try again it will send 3 dollars or more
Please note the value I am sending over the API is fixed 1 dollar
but its like its saving that dollar then when I try again it will be 2 dollars
then 3 going up even if I try for another number.
Here is the code I am using
from paynow import Paynow
import time
from datetime import datetime
import uuid
class PayNowPayment():
paynow = Paynow(
‘1XXXXXXX’,
‘8bXXXXXXXX’,
‘https://tmmobilemechanics.co.za/’,
‘https://tmmobilemechanics.co.za/’
)
def make_mobile_payment(self, email, phone_number, payment_method, movie, amount):
try:
paynow = self.paynow
print("Now making mayment")
# payment = paynow.create_payment( str(uuid.uuid4()).replace("-", "")[:12].upper() , email)
email = email + "Test"
payment = paynow.create_payment(str(uuid.uuid4()).replace("-", "")[:12].upper(), phone_number)
payment.add(movie, amount)
response = paynow.send_mobile(payment, phone_number , payment_method)
time.sleep(30)
print(f"Now response: {response}")
trans_status = paynow.check_transaction_status(response.poll_url)
print(f"Transaction {trans_status.status}")
if trans_status.paid:
return trans_status
return trans_status
except Exception as e:
print(e)
raise e
PayNowPayment.make_mobile_payment(email="panashe22lunga@gmail.com",
phone_number="0776705860",
payment_method="ecocash",
movie="Avengers: Endgame",
amount=1)