Showing results for 
Search instead for 
Did you mean: 

Accept.js with ARB python

I'm trying to create a subscription.


There is this python gist


The problem is this does it with the credit card info.  I'm trying to use the accept.js and pass that to make the subscription.


Is there a sample code of this?


I've managed to get the subscription working with the accept.js, but the problem I'm having now is that it does not populate the description, the customer id, or the customer's email.  Is there something I'm missing?


# Create a merchantAuthenticationType object with authentication details
# retrieved from the constants file
merchantAuth = apicontractsv1.merchantAuthenticationType() = app_config.AUTHORIZE_KEYS['apiLoginId']
merchantAuth.transactionKey = app_config.AUTHORIZE_KEYS['transactionKey']
# Set the transaction's refId

# Create the payment object for a payment nonce
opaqueData = apicontractsv1.opaqueDataType()
opaqueData.dataDescriptor = request.form['dataDesc']
opaqueData.dataValue = request.form['dataValue']

# Add the payment data to a paymentType object
paymentOne = apicontractsv1.paymentType()
paymentOne.opaqueData = opaqueData

# Create order information
order = apicontractsv1.orderType()
order.invoiceNumber = "10101"
order.description = "Your Description"

# Set the customer's identifying information
customerData = apicontractsv1.customerDataType()
customerData.type = "individual" = 'cool_1231123" =

paymentschedule = apicontractsv1.paymentScheduleType()
paymentschedule.interval = apicontractsv1.paymentScheduleTypeInterval() # apicontractsv1.CTD_ANON() #modified by krgupta
paymentschedule.interval.length = 1
paymentschedule.interval.unit = apicontractsv1.ARBSubscriptionUnitEnum.months
paymentschedule.startDate ='US/Mountain'))
paymentschedule.totalOccurrences = 999
# Giving the credit card info
# Setting billing information
billto = apicontractsv1.nameAndAddressType()
billto.firstName = request.form['first']
billto.lastName = request.form['last'] = request.form['email']
# Setting subscription details
subscription = apicontractsv1.ARBSubscriptionType() = "Monthly Subscription"
subscription.description = "Monthly"
subscription.paymentSchedule = paymentschedule
subscription.amount = Decimal(request.form['amount'])
subscription.billTo = billto
subscription.payment = paymentOne
# Creating the request
arbrequest = apicontractsv1.ARBCreateSubscriptionRequest()
arbrequest.merchantAuthentication = merchantAuth
arbrequest.subscription = subscription
# Creating and executing the controller
controller = ARBCreateSubscriptionController(arbrequest)
# Getting the response
response = controller.getresponse()

if response is not None:
# Check to see if the API request was successfully received and acted upon
if (response.messages.resultCode == "Ok"):
print ("SUCCESS:")
print ("Message Code : %s" % response.messages.message[0]['code'].text)
print ("Message text : %s" % str(response.messages.message[0]['text'].text))
print ("Subscription ID : %s" % response.subscriptionId)
print ("ERROR:")
print ("Message Code : %s" % response.messages.message[0]['code'].text)
print ("Message text : %s" % response.messages.message[0]['text'].text)

Any help would be greatful