AuthorizeNet / sdk-node

Node.js SDK for the Authorize.Net payments platform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

E00121: No default payment/shipping profile found

mkarbowiak opened this issue · comments

I create CustomerProfile with CustomerPaymentProfile assgined. Here's the CustomerPaymentProfileType object that I use.

// createCustomerProfile.js

let customerPaymentProfileType = new ApiContracts.CustomerPaymentProfileType({
  customerType: 'individual',
  payment: new ApiContracts.PaymentType({ creditCard: creditCard }),
  defaultPaymentProfile: true,
});

Whole request is successful and I can see CustomerProfile with PaymentProfile assigned on my sandbox account in the CIM section.

However, when I try to authorize the payment using only CustomerProfileId

// authorizePayment.js

let profileToAuthorize = new ApiContracts.CustomerProfilePaymentType({
  customerProfileId: data.profileId,
});

let transactionRequestType = new ApiContracts.TransactionRequestType({
  transactionType: ApiContracts.TransactionTypeEnum.AUTHONLYTRANSACTION,
  profile: profileToAuthorize,
  amount: data.amount,
});

let createRequest = new ApiContracts.CreateTransactionRequest({
  merchantAuthentication: merchantAuthenticationType,
  transactionRequest: transactionRequestType,
});

there's an error:

Failed Transaction.
Error Code: E00121
Error message: No default payment/shipping profile found.

I tried to create customerPaymentProfileType like this, for double check's sake:

// createCustomerProfile.js

let customerPaymentProfileType = new ApiContracts.CustomerPaymentProfileType();
customerPaymentProfileType.setCustomerType('individual')
customerPaymentProfileType.setPayment(new ApiContracts.PaymentType({ creditCard: creditCard }));
customerPaymentProfileType.setDefaultPaymentProfile(true);

which also creates a CustomerProfile but the authorization fails anyway.

The authorization is successful only when I explicitly provide CustomerPaymentProfileId

// authorizePayment.js
// create profileToAuthorize like before

let paymentProfile = new ApiContracts.PaymentProfile({
  paymentProfileId: data.paymentProfileId
});

profileToAuthorize.setPaymentProfile(paymentProfile);

// create transaction and request like before
Successfully created transaction with Transaction ID:
Response Code: 1
Message Code: 1
Description: This transaction has been approved.

Hi @mkarbowiak ,

Thanks for bringing this to our attention. We will communicate this issue with the CreateCustomerProfile API to the relevant team to get it addressed.

In the meantime, a suitable workaround for this is shown below:

Having same issue, from what I can see livemode validation would not work with the workaround