Skip to content

Commit 41933fa

Browse files
committed
Sample code for create customer payment profile
Adds sample code for creating customer payment profile for a given customer profile id. Signed-off-by: Srijan Misra <[email protected]>
1 parent e635400 commit 41933fa

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from authorizenet import apicontractsv1
2+
from authorizenet.apicontrollers import *
3+
4+
merchantAuth = apicontractsv1.merchantAuthenticationType()
5+
merchantAuth.name = '5KP3u95bQpv'
6+
merchantAuth.transactionKey = '4Ktq966gC55GAX7S'
7+
8+
creditCard = apicontractsv1.creditCardType()
9+
creditCard.cardNumber = "4111111111111111"
10+
creditCard.expirationDate = "2020-12"
11+
12+
payment = apicontractsv1.paymentType()
13+
payment.creditCard = creditCard
14+
15+
profile = apicontractsv1.customerPaymentProfileType()
16+
profile.payment = payment
17+
18+
createCustomerPaymentProfile = apicontractsv1.createCustomerPaymentProfileRequest()
19+
createCustomerPaymentProfile.merchantAuthentication = merchantAuth
20+
createCustomerPaymentProfile.paymentProfile = profile
21+
createCustomerPaymentProfile.customerProfileId = '36731856'
22+
23+
createCustomerPaymentProfileController = createCustomerPaymentProfileController(createCustomerPaymentProfile)
24+
createCustomerPaymentProfileController.execute()
25+
26+
response = createCustomerPaymentProfileController.getresponse()
27+
28+
if (response.messages.resultCode=="Ok"):
29+
print "Successfully created a customer payment profile with id: %s" % response.customerPaymentProfileId
30+
else:
31+
print "Failed to create customer payment profile %s" % response.messages.message[0].text

0 commit comments

Comments
 (0)