The WingMoney API can be used to execute transactions through Wing. Here are some CURL examples. Note that these examples actually work so feel free to try them. For examples in Ruby, see the wing-money-ruby gem.
WingToWing Transactions can be created to send funds from one Wing Account to another.
api_token
- Your API Token. For test transactions you can use the API Token
test_a75d8f5cda47be2c0e164ff96022cb71b6f8dd379ff629eb7ea22c06bd1d1e0a
- Your API Token. For test transactions you can use the API Token
The request parameters are described below:
amount
- The amount you wish to transfer. For usd this amount is in cents. For khr it's in Riel. E.g. 1000
currency
- The currency of the transfer. Must be 'usd' or 'khr'. E.g. usd
wing_account_number
- The Wing account number of the sender. E.g. 383662. One of wing_account_number OR wing_card_number is required
wing_card_number
- The Wing card number of the sender. E.g. 5018180000383662. One of wing_card_number OR wing_account_number is required
wing_account_pin
- The 4 digit Wing account PIN of the sender. E.g. 2008
wing_destination_account_number
- The Wing account number of the receiver. E.g. 1614
khr_usd_buy_rate
- How much khr you will buy for 1 usd cent. E.g. if you request to transfer amount: '1000' in currency: 'usd' ($10) from a khr account and you set the khr_usd_buy_rate: '41' the receiver will receive 41000 in khr (41,000R). Note this rate will only apply if the requested currency is usd but the sender's account is khr.
khr_usd_sell_rate
- How much khr you will sell for 1 usd cent. E.g. if you request to transfer amount: '40000' in currency: 'khr' (40,000R) from a usd account and you set te khr_usd_sell_rate: '40' the receiver will receive 1000 in usd ($10). Note this rate will only apply if the requested currency is khr but the sender's account is usd.
wing_destination_usd_account_number
- Optional. An alternate account to receive usd transactions. E.g. If the sender's account is usd but the destination account is khr and wing_destination_usd_account_number is set, wing_destination_usd_account will override wing_destination_account_number and the funds will be transfered to wing_destination_usd_account_number instead. Use to avoid Wing currency exchange fees.
wing_destination_khr_account_number
- Optional. An alternate account to receive khr transactions. E.g. If the sender's account is khr but the destination account is usd and wing_destination_khr_account_number is set, wing_destination_khr_account will override wing_destination_account_number and the funds will be transfered to wing_destination_khr_account_number instead. Use to avoid Wing currency exchange fees.
curl --header "Authorization: Bearer test_a75d8f5cda47be2c0e164ff96022cb71b6f8dd379ff629eb7ea22c06bd1d1e0a" -v -k -d "wing_transaction_wing_to_wing[wing_account_number]=383662&wing_transaction_wing_to_wing[wing_account_pin]=2008&wing_transaction_wing_to_wing[amount]=1000&wing_transaction_wing_to_wing[currency]=usd&wing_transaction_wing_to_wing[khr_usd_buy_rate]=41.5&wing_transaction_wing_to_wing[khr_usd_sell_rate]=40&wing_transaction_wing_to_wing[wing_destination_account_number]=1614&wing_transaction_wing_to_wing[wing_destination_usd_account_number]=1614&wing_transaction_wing_to_wing[wing_destination_khr_account_number]=1615" "https://wing-money.bongloy.com/api/v1/wing_transaction/wing_to_wings"
{"id":42,"livemode":false,"created_at":"2014-08-17T08:42:32.153Z","result":{"wing_response":{"successful":true,"result":"SUCCESS","error_code":null,"error_message":"SUCCESS","amount_khr":41500,"amount_usd":0,"balance":{"amount":271560,"currency":"khr"},"total":{"amount":42500,"currency":"khr"},"fee":{"amount":1000,"currency":"khr"},"transaction_id":"EAA747856","tid":"EAA747856","recipient_account_name":"WCX KHR","recipient_account_number":"1615"}},"executed":true}
curl --header "Authorization: Bearer test_a75d8f5cda47be2c0e164ff96022cb71b6f8dd379ff629eb7ea22c06bd1d1e0a" -v -k -d "wing_transaction_wing_to_wing[wing_card_number]=5018188000383662&wing_transaction_wing_to_wing[wing_account_pin]=2008&wing_transaction_wing_to_wing[amount]=1000&wing_transaction_wing_to_wing[currency]=usd&wing_transaction_wing_to_wing[khr_usd_buy_rate]=41.5&wing_transaction_wing_to_wing[khr_usd_sell_rate]=40&wing_transaction_wing_to_wing[wing_destination_account_number]=1614&wing_transaction_wing_to_wing[wing_destination_usd_account_number]=1614&wing_transaction_wing_to_wing[wing_destination_khr_account_number]=1615" "https://wing-money.bongloy.com/api/v1/wing_transaction/wing_to_wings"
{"id":45,"livemode":false,"created_at":"2014-09-06T08:35:34.298Z","result":{"wing_response":{"successful":true,"result":"SUCCESS","error_code":null,"error_message":"SUCCESS","amount_khr":41500,"amount_usd":0,"balance":{"amount":144060,"currency":"khr"},"total":{"amount":42500,"currency":"khr"},"fee":{"amount":1000,"currency":"khr"},"transaction_id":"EAA748136","tid":"EAA748136","recipient_account_name":"WCX KHR","recipient_account_number":"1615"}},"executed":true}
curl --header "Authorization: Bearer test_a75d8f5cda47be2c0e164ff96022cb71b6f8dd379ff629eb7ea22c06bd1d1e0a" -v -k -d "wing_transaction_wing_to_wing[wing_account_pin]=2008&wing_transaction_wing_to_wing[amount]=1000&wing_transaction_wing_to_wing[currency]=usd&wing_transaction_wing_to_wing[khr_usd_buy_rate]=41.5&wing_transaction_wing_to_wing[khr_usd_sell_rate]=40&wing_transaction_wing_to_wing[wing_destination_account_number]=1614&wing_transaction_wing_to_wing[wing_destination_usd_account_number]=1614&wing_transaction_wing_to_wing[wing_destination_khr_account_number]=1615" "https://wing-money.bongloy.com/api/v1/wing_transaction/wing_to_wings"
{"errors":{"wing_account_number":["can't be blank"],"wing_card_number":["can't be blank"]}}