Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Home
Loic Teixeira edited this page May 28, 2018
·
1 revision
Welcome to the eway-rapid-python wiki!
importrequestsenvironment='test'environment='production'_api_key='xxxxxxxxxxxxxxxx'#Eway - API Key_api_password='zzzz'#Eway - API Passwordtrans_type='Refund'refund_amount=100# Refund amountrefund_payload= { "TotalAmount": refund_amount, "InvoiceNumber": "Inv 21540", "InvoiceDescription": "Individual Invoice Description", "InvoiceReference": "513456",
"CurrencyCode": "AUD"
}
transaction_id=17799963#Refund against which eway transactionifenvironment=='test':
refund_url=r'https://api.sandbox.ewaypayments.com/Transaction/'+transaction_id+'/Refund'else:
refund_url=r'https://api.ewaypayments.com/Transaction/'+transaction_id+'/Refund'json_payload= {
'Customer': 'XYZ Customer',
'Refund': refund_payload,
'ShippingAddress': 'ShippingAddress',
}
response=requests.post(refund_url, auth=(_api_key, _api_password), data=json_payload, headers={'Content-Type': 'application/json'})
return {'response': response}