zuora4r
Client for Zuora API
This is a wrapper for sample code provided by Zuora
It contains minor changes as well as added support for ‘generate’ API call
It also provides scripts to query, create, update, delete Zuora Objects, as well as make payment & bill runs.
Installing the Gem
$ sudo gem sources -a http://gemcutter.org
$ sudo gem install zuora4r
Usage
zuora-query -u <username> -p <password> -e [prod|sandbox] <query>
zuora-create -u <username> -p <password> -e [prod|sandbox] <json representing object to create>
zuora-update -u <username> -p <password> -e [prod|sandbox] <json representing object to update>
zuora-delete -u <username> -p <password> -e [prod|sandbox] -t [Account|Subscription|Payment|...] -i <id_1,...>
zuora-payment-run -u <username> -p <password> -e [prod|sandbox] -a <account id> -i <invoice id> -d <effective date> -m <payment method id>
zuora-bill-run -u <username> -p <password> -e [prod|sandbox] -a <account id> -i <invoice date> -t <target date>
Examples
export ZUSER=zuora_username
export ZPASS=zuora_password
# create new payment method
zuora-create -u $ZUSER -p $ZPASS -e sandbox '{"PaymentMethod": {"accountId": "4028e6992a031d78012a1b132dba1c9b", "creditCardAddress1": "52 Vexford Lane", "creditCardCity": "United States", "creditCardExpirationMonth": "12", "creditCardExpirationYear": "2010", "creditCardHolderName": "Firstly Lastly", "creditCardNumber": "4111111111111111", "creditCardPostalCode": "22042", "creditCardState": "California", "creditCardType": "Visa", "type": "CreditCard"}}'
[
{
"success": true,
"id": "4028e6992b31191e012b3cf9a3b338c5"
}
]
# find all payment methods for a given account
zuora-query -u $ZUSER -p $ZPASS -e sandbox "Select Id, CreditCardMaskNumber from PaymentMethod where AccountId = '4028e6992a031d78012a1b132dba1c9b'"
[
{
"creditCardMaskNumber": "************1111",
"id": "4028e6992b31191e012b3cf9a3b338c5"
},
]
# make above added payment method to be default for the account
zuora-update -u $ZUSER -p $ZPASS -e sandbox '{"Account": {"id": "4028e6992a031d78012a1b132dba1c9b", "defaultPaymentMethodId": "4028e6992b31191e012b3cf9a3b338c5"}}'
[
{
"success": true,
"id": "4028e6992a031d78012a1b132dba1c9b"
}
]
# check account's default payment method
zuora-query -u $ZUSER -p $ZPASS -e sandbox "Select DefaultPaymentMethodId from Account where Id = '4028e6992a031d78012a1b132dba1c9b'"
[
{
"defaultPaymentMethodId": "4028e6992b31191e012b3cf9a3b338c5"
}
]
# delete payment method
zuora-delete -u $ZUSER -p $ZPASS -e sandbox -t PaymentMethod -i 4028e6992b31191e012b3cf9a3b338c5
[
{
"success": true,
"id": "4028e6992b31191e012b3cf9a3b338c5"
}
]
Copyright
Copyright © 2010 Ning. See LICENSE for details.