cancel
Showing results for 
Search instead for 
Did you mean: 

Accept Hosted Form: How Can I Get Payment Profiles with getHostedPaymentPageRequest Call (C#)?

Hi,

 

In the Accept Hosted documentation, there is a note below the Presenting Payment Options header in the following section:

 

https://developer.authorize.net/api/reference/features/accept_hosted.html#Requesting_the_Form_Token

 

The note reads:

 

NOTE: If you use the Customer Profiles feature to store customer payment information, you can send a customer profile ID in the customerProfileId element of the getHostedPaymentPageRequest call. When the browser displays the form, the four most recent payment profiles for that customer profile are displayed as shown in the image below. The customer can choose among these payment methods or enter new payment information, and save the new payment information in a payment profile that can be used in later transactions.

 

Is this true? If so, can you please provide an example of how to send the customer profile ID in the getHostedPaymentPageRequest call? I cannot access the customerProfileId member: getHostedPaymentPageRequest().profile.customerProfileId. I keep getting a null reference error because profile is null, even if I try to assign a customer profile ID directly in the request.  

 

Thanks!

ALPS
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

 

I solved this issue on my own. Yes, the note is true, but it's more complex than it indicates and should be made more clear and specific, because customer profile access is an important feature.

 

The getHostedPaymentPageRequest().profile member is a field of the transactionRequestType and the customerProfilePaymentType. In order to reach the profile field customerProfilePaymentType must be instantiated so customerProfileId can be accessed, like this:

 

var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
amount = request.Amount,
profile = new customerProfilePaymentType { customerProfileId = "XXXXXXXXXX" }
};

 

Thanks.

View solution in original post

ALPS
Member
3 REPLIES 3

Hi,

 

I solved this issue on my own. Yes, the note is true, but it's more complex than it indicates and should be made more clear and specific, because customer profile access is an important feature.

 

The getHostedPaymentPageRequest().profile member is a field of the transactionRequestType and the customerProfilePaymentType. In order to reach the profile field customerProfilePaymentType must be instantiated so customerProfileId can be accessed, like this:

 

var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
amount = request.Amount,
profile = new customerProfilePaymentType { customerProfileId = "XXXXXXXXXX" }
};

 

Thanks.

ALPS
Member

@ALPS wrote:

Hi,

 

I solved this issue on my own. Yes, the note is true, but it's more complex than it indicates and should be made more clear and specific, because customer profile access is an important feature.

 

The getHostedPaymentPageRequest().profile member is a field of the transactionRequestType and the customerProfilePaymentType. In order to reach the profile field customerProfilePaymentType must be instantiated so customerProfileId can be accessed, like this: pakistan rentacar

 

var transactionRequest = new transactionRequestType
{
transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
amount = request.Amount,
profile = new customerProfilePaymentType { customerProfileId = "XXXXXXXXXX" }
};

 

Thanks.

 

Thank you for posting your solution so that others can also get benefit from it.


 

I was looking for solution for almost 2 weeks now. This solution worked for me. Thank you so much for sharing this.