I’ve test it for valid card and also few times I recreate transaction keys but it helpless.
I checked all forums about this.
Ive got 007 code error which says
Posting a live account’s API Login ID and Transaction Key to the test environment at https://apitest.authorize.net/xml/v1/request.api. For live accounts, please post to https://api.authorize.net/xml/v1/request.api instead.
Posting a test account’s API Login ID and Transaction Key to the live environment at https://api.authorize.net/xml/v1/request.api. For test accounts, please post to https://apitest.authorize.net/xml/v1/request.api instead.
The API Login ID or Transaction Key have errors.
Im sure all my creds are correct, I cheched it 100 times.
first of all I create customer payment profile if it does not exists already
def create_customer_profile(cls, user: User, merchant_auth):
if not user.customer_profile_id:
customer_data = {
"merchantCustomerId": str(user.id),
"email": user.email,
}
create_customer_profile = apicontractsv1.createCustomerProfileRequest()
create_customer_profile.merchantAuthentication = merchant_auth
create_customer_profile.profile = apicontractsv1.customerProfileType(
**customer_data
)
controller = createCustomerProfileController(create_customer_profile)
controller.execute()
response = controller.getresponse()
if response.messages.resultCode == "Ok":
user.customer_profile_id = response.customerProfileId
user.save()
return response.customerProfileId
else:
raise TransactionCanceled(
message=str(response.messages.message[0]["text"].text)
)
return user.customer_profile_id
after that I try to create customer payment profile with all credit card and billing data
@classmethod
def create_customer_payment_profile(
cls, card_details, billing_address, user: User, default: bool
):
merchant_auth = cls.merchant_auth()
payment = apicontractsv1.paymentType()
credit_card = apicontractsv1.creditCardType()
credit_card.cardNumber = card_details["card_number"]
credit_card.expirationDate = card_details["mm_yy"]
credit_card.cardCode = card_details["cvv"]
payment.creditCard = credit_card
profile = apicontractsv1.customerPaymentProfileType()
profile.payment = payment
profile.billTo = apicontractsv1.customerAddressType()
profile.billTo.address = billing_address["address_1"]
profile.billTo.city = billing_address["city"]
profile.billTo.state = billing_address["state"]
profile.billTo.zip = billing_address["postal_code"]
create_payment_profile_request = (
apicontractsv1.createCustomerPaymentProfileRequest()
)
create_payment_profile_request.merchantAuthentication = merchant_auth
create_payment_profile_request.paymentProfile = profile
create_payment_profile_request.customerProfileId = str(
cls.create_customer_profile(user, merchant_auth)
)
create_payment_profile_request.defaultPaymentProfile = default
controller = createCustomerPaymentProfileController(
create_payment_profile_request
)
controller.execute()
response = controller.getresponse()
return response.customerPaymentProfileId
the body is like
{
“payment_method”: {
“card_holder”: “name surname”,
“card_number”: “valid card numbers”,
“mm_yy”: “valid exp”,
“cvv”: “valid cvv”
},
“billing_address”: {
“address_1”: “valid adr1”,
“city”: “valid City”,
“state”: “valdi state”,
“postal_code”: “valid postal_code”
}
}