Google Pay Integration Issue with Authorize.net – Invalid Ownership Error - Stack Overflow

I'm trying to integrate Google Pay with Authorize, but I'm encountering an error that suggest

I'm trying to integrate Google Pay with Authorize, but I'm encountering an error that suggests my account setup might be incorrect. Specifically, I see an "invalid ownership" error when attempting a transaction.

Error Code 153 
There was an error processing the payment data. Invalid ownership..

What I’ve Done So Far:

  1. Followed the Authorize Google Pay setup guide.
  2. Ensured my Authorize account is on a supported processor.
  3. Generated my Authorize API Login ID and Transaction Key.
  4. Enabled the service in the Authorize Merchant Interface.
  5. Confirmed my app meets Google Pay Developer Requirements.
  6. Issue: I think I didn’t generate my Google Pay Public Key properly.
    • Under the "Requirements for Google Pay with Authorize" section, it states: "You must generate a Google Pay public key."
    • In the "Enabling Google Pay in the Merchant Interface" section, Step 5 says to enter a KeySet ID from Google, which I don’t think I have.

Questions:

  1. How do I correctly generate the Google Pay Public Key and KeySet ID for Authorize?
  2. In Google Pay & Wallet Console, what exact steps should I follow to get the KeySet ID?
  3. Could the "invalid ownership" error be related to not having the correct public key set up?

Screenshots:

I've attached relevant screenshots of my setup to show where I'm stuck.

Any help would be greatly appreciated!


Update 01/29/2025 -- Added code -- full end-to-end steps

Primary Issue

Tech Stack: Ionic 6 / Angular 16 / Capacitor / C# .NET API

Google Pay Library: @ionic-enterprise/google-pay": "^2.2.2

When I make my request to Google Pay to authorize a transaction, I send to google (after initializing the payment instance) this GooglePayTransactionInfo object.

const googlePayTransactionInfo: GooglePayTransactionInfo = {
  countryCode: 'US',
  currencyCode: 'USD',
  totalPrice: amount.toString(),
  totalPriceStatus: 'FINAL',
};

The user clicks the “Pay with Google Pay” button. Our mobile app calls on GooglePay.makePaymentRequest({..}) via this makePaymentRequest off our Component GooglePayService.

const response = await this.googlePayService.makePaymentRequest(googlePayTransactionInfo);

The response from this request from Google Pay contains the Token that we need to use in the Authorize.NET C# SDK to process the Google Payment as shown in the sample implementation code.

The response we get back looks like this:

... and a few more details about the tokenizationData

After we get this response, we convert the token paymentMethodData.tokenizationData.token to its base-64 representation

obj.Token = window.btoa(response.paymentMethodData.tokenizationData.token);

Next, we, as per the Authorize.NET C# SDK example, call our API which uses the Authorize.NET C# SDK as follows: (notice we set the opaqueDataType.dataValue equal to the above encrypted token ...window.btoa(..) )

[HttpPost("api/payment/a/b")]
[ProducesResponseType(200)]
public async Task<ActionResult> ProcessGooglePayPaymentIntentAsync(GooglePayIntentDto googlePayIntentDto)
{
    try
    {
        var environment = Configuration["Environment"];
        var apiLoginId = Configuration["ApiLoginId"];
        var transactionKey = Configuration["TransactionKey"];

        environment.ValidateArgNotNull(nameof(environment));
        apiLoginId.ValidateArgNotNull(nameof(apiLoginId));
        transactionKey.ValidateArgNotNull(nameof(transactionKey));

        if (googlePayIntentDto.Token == null)
        {
            throw new System.Exception("Token is null.");
        }

        // Set up API credentials
        ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = environment == "Production" ? AuthorizeNet.Environment.PRODUCTION : AuthorizeNet.Environment.SANDBOX; 

        ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
        {
            name = apiLoginId, // API Login ID
            ItemElementName = ItemChoiceType.transactionKey,
            Item = transactionKey // Transaction Key
        };

        var decimalAmount = decimal.Parse(googlePayIntentDto.AmountAsString);

        var opaqueData = new opaqueDataType()
        {
            dataDescriptor = "COMMON.GOOGLE.INAPP.PAYMENT",
            dataValue = googlePayIntentDto.Token,
        };

        var paymentType = new paymentType()
        {
            Item = opaqueData
        };

        var lineItems = new lineItemType[]
        {
            new lineItemType()
            {
                itemId = "1",
                name = "My Sample Product",
                description =”My sample product description”,
                quantity = 1,
                unitPrice = decimalAmount
            }
        };

        var tax = new extendedAmountType()
        {
            amount = 0,
            name = "Zero Tax",
            description = "Zero Tax"
        };

        var userFields = new userField[]
        {
            new userField()
            {
                name = "UserId",
                value = Constants.UserId.ToString()
            }
        };

        var transactionRequest = new transactionRequestType()
        {
            transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
            amount = decimalAmount,
            payment = paymentType,
            lineItems = lineItems,
            tax = tax,
            userFields = userFields
        };

        var request = new createTransactionRequest { transactionRequest = transactionRequest };

        var controller = new createTransactionController(request);
        controller.Execute();

        var response = controller.GetApiResponse();
        var transactionResult = "";

And everything seems to work properly, but the response that we get via

var response = controller.GetApiResponse();

is the following:

I'm trying to integrate Google Pay with Authorize, but I'm encountering an error that suggests my account setup might be incorrect. Specifically, I see an "invalid ownership" error when attempting a transaction.

Error Code 153 
There was an error processing the payment data. Invalid ownership..

What I’ve Done So Far:

  1. Followed the Authorize Google Pay setup guide.
  2. Ensured my Authorize account is on a supported processor.
  3. Generated my Authorize API Login ID and Transaction Key.
  4. Enabled the service in the Authorize Merchant Interface.
  5. Confirmed my app meets Google Pay Developer Requirements.
  6. Issue: I think I didn’t generate my Google Pay Public Key properly.
    • Under the "Requirements for Google Pay with Authorize" section, it states: "You must generate a Google Pay public key."
    • In the "Enabling Google Pay in the Merchant Interface" section, Step 5 says to enter a KeySet ID from Google, which I don’t think I have.

Questions:

  1. How do I correctly generate the Google Pay Public Key and KeySet ID for Authorize?
  2. In Google Pay & Wallet Console, what exact steps should I follow to get the KeySet ID?
  3. Could the "invalid ownership" error be related to not having the correct public key set up?

Screenshots:

I've attached relevant screenshots of my setup to show where I'm stuck.

Any help would be greatly appreciated!


Update 01/29/2025 -- Added code -- full end-to-end steps

Primary Issue

Tech Stack: Ionic 6 / Angular 16 / Capacitor / C# .NET API

Google Pay Library: @ionic-enterprise/google-pay": "^2.2.2

When I make my request to Google Pay to authorize a transaction, I send to google (after initializing the payment instance) this GooglePayTransactionInfo object.

const googlePayTransactionInfo: GooglePayTransactionInfo = {
  countryCode: 'US',
  currencyCode: 'USD',
  totalPrice: amount.toString(),
  totalPriceStatus: 'FINAL',
};

The user clicks the “Pay with Google Pay” button. Our mobile app calls on GooglePay.makePaymentRequest({..}) via this makePaymentRequest off our Component GooglePayService.

const response = await this.googlePayService.makePaymentRequest(googlePayTransactionInfo);

The response from this request from Google Pay contains the Token that we need to use in the Authorize.NET C# SDK to process the Google Payment as shown in the sample implementation code.

The response we get back looks like this:

... and a few more details about the tokenizationData

After we get this response, we convert the token paymentMethodData.tokenizationData.token to its base-64 representation

obj.Token = window.btoa(response.paymentMethodData.tokenizationData.token);

Next, we, as per the Authorize.NET C# SDK example, call our API which uses the Authorize.NET C# SDK as follows: (notice we set the opaqueDataType.dataValue equal to the above encrypted token ...window.btoa(..) )

[HttpPost("api/payment/a/b")]
[ProducesResponseType(200)]
public async Task<ActionResult> ProcessGooglePayPaymentIntentAsync(GooglePayIntentDto googlePayIntentDto)
{
    try
    {
        var environment = Configuration["Environment"];
        var apiLoginId = Configuration["ApiLoginId"];
        var transactionKey = Configuration["TransactionKey"];

        environment.ValidateArgNotNull(nameof(environment));
        apiLoginId.ValidateArgNotNull(nameof(apiLoginId));
        transactionKey.ValidateArgNotNull(nameof(transactionKey));

        if (googlePayIntentDto.Token == null)
        {
            throw new System.Exception("Token is null.");
        }

        // Set up API credentials
        ApiOperationBase<ANetApiRequest, ANetApiResponse>.RunEnvironment = environment == "Production" ? AuthorizeNet.Environment.PRODUCTION : AuthorizeNet.Environment.SANDBOX; 

        ApiOperationBase<ANetApiRequest, ANetApiResponse>.MerchantAuthentication = new merchantAuthenticationType()
        {
            name = apiLoginId, // API Login ID
            ItemElementName = ItemChoiceType.transactionKey,
            Item = transactionKey // Transaction Key
        };

        var decimalAmount = decimal.Parse(googlePayIntentDto.AmountAsString);

        var opaqueData = new opaqueDataType()
        {
            dataDescriptor = "COMMON.GOOGLE.INAPP.PAYMENT",
            dataValue = googlePayIntentDto.Token,
        };

        var paymentType = new paymentType()
        {
            Item = opaqueData
        };

        var lineItems = new lineItemType[]
        {
            new lineItemType()
            {
                itemId = "1",
                name = "My Sample Product",
                description =”My sample product description”,
                quantity = 1,
                unitPrice = decimalAmount
            }
        };

        var tax = new extendedAmountType()
        {
            amount = 0,
            name = "Zero Tax",
            description = "Zero Tax"
        };

        var userFields = new userField[]
        {
            new userField()
            {
                name = "UserId",
                value = Constants.UserId.ToString()
            }
        };

        var transactionRequest = new transactionRequestType()
        {
            transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),
            amount = decimalAmount,
            payment = paymentType,
            lineItems = lineItems,
            tax = tax,
            userFields = userFields
        };

        var request = new createTransactionRequest { transactionRequest = transactionRequest };

        var controller = new createTransactionController(request);
        controller.Execute();

        var response = controller.GetApiResponse();
        var transactionResult = "";

And everything seems to work properly, but the response that we get via

var response = controller.GetApiResponse();

is the following:

Share Improve this question edited Jan 30 at 2:28 Robert Green MBA asked Jan 29 at 6:01 Robert Green MBARobert Green MBA 1,8863 gold badges29 silver badges56 bronze badges 2
  • Please do not upload images of code/data/errors. - Can you please edit the question and focus on a single problem? You are asking multiple questions at once. Furthermore please tag the programming-language you are using as well. – DarkBee Commented Feb 4 at 10:36
  • Are you able to run your code successfully using your sandbox account? – SoftwareDveloper Commented Feb 5 at 17:40
Add a comment  | 

1 Answer 1

Reset to default -2

I was facing the same issue while integrating GooglePay in Authroise.

I have done two more configuration to resolve this.

  • Enabled Android Pay on Authorise account.
  • Add KeySetID : 12345678901234567890 on Authorise account. (this is sandbox, once you go live, google will provide KeySetId)
  • When calling/instantiating Google Pay API in Javascript, you need to pass Gateway ID.

Like this

var tokenizationSpecification = {
        type: 'PAYMENT_GATEWAY',
        parameters: {
            'gateway': 'authorizenet',
            'gatewayMerchantId': 'xxxxxxxx'
        }
    };

This GatewayMerchantID you can get from Authroise account. For sandbox it will be on this page: Account/Billing Information/Payment Gateway ID[xxxxxx]

Hope it helps.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745309726a4621931.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信