Showing results for 
Search instead for 
Did you mean: 

How to use CreateCustomerPaymentProfile(long profile_id) in c# ?

Hi.. I am downloadng your CIM C# sample code. And use web services. Now in my local pc I am Creating Sample page

"Default.aspx" and write function CreateCustomerPaymentProfile(long profile_id) . and call it on Page Load. I am Sign up

and in EXAMPLE_MERCHANT_NAME give Login ID and EXAMPLE_TRANSACTION_KEY gives transuction id.

         So can you please tell me how can i test account and in page load i am calling function CreateCustomerPaymentProfile(long profile_id)  and which profile_id can i give to work it properly.

               Now i am testing so it return "0"

Please help me urgently, i am so new i this field.


Thanks in Advance :manvery-happy:


Put it in debug and see what error message is in response.messages and response.validationDirectResponse .

Also, it wasn't clear is your message that you have a valid profile_id, a valid profile_id is required to create payment profile.


Hi i am using below test code and it return 0



using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using net.authorize.apitest;
using CustomerProfileAPI;

public partial class _Default : System.Web.UI.Page
    protected void Page_Load(object sender, EventArgs e)

    public void CreateCustomerPaymentProfile(long profile_id)
        CustomerPaymentProfileType new_payment_profile = new CustomerPaymentProfileType();
        PaymentType new_payment = new PaymentType();

        //BankAccountType new_bank = new BankAccountType();
        //new_bank.accountNumber = "4111111";

        CreditCardType new_card = new CreditCardType();
        new_card.cardNumber = "4111111111111111";
        new_card.expirationDate = "2012-10";
        new_payment.Item = new_card;
        //new_payment.Item = new_bank;

        new_payment_profile.payment = new_payment;
        //ArrayOfCustomerPaymentProfileType pay_list = new ArrayOfCustomerPaymentProfileType();

        CreateCustomerPaymentProfileResponseType response = SoapAPIUtilities.Service.CreateCustomerPaymentProfile(SoapAPIUtilities.MerchantAuthentication, profile_id, new_payment_profile, ValidationModeEnum.liveMode);

        long out_id = 0;
        Console.WriteLine("Response Code: " + response.resultCode);
        for (int i = 0; i < response.messages.Length; i++)
            Console.WriteLine("Message: " + response.messages[i].text);

        out_id = response.customerPaymentProfileId;


1) Did you replace 1234 with a valid customer profile ID? If not, use CreateCustomerProfile method to create one first.

2) Did you run debug and stop a the

Console.WriteLine("Message: " + response.messages[i].text);

 Line and see what in response.messages? Really can't help you without knowing the error message.


CIM documentation