添加客户多笔付款时如何解决名称空间中元素'createCustomerProfileRequest'的错误 [英] How to solve the error of The element 'createCustomerProfileRequest' in namespace while adding the customer mutiple payment

查看:106
本文介绍了添加客户多笔付款时如何解决名称空间中元素'createCustomerProfileRequest'的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在authorize.net中添加单个客户的多个付款资料.经过长时间的搜索,我到达了在authorize.net社区上发布的帖子,请参见

I want to add the multiple payment profiles of a single customer in authorize.net. After a long searching I reached a post posted on the community of the authorize.net see link. In this link there a xml formated data in the accepted solution I convert it and send it through the postman then I'm facing the error of

名称空间'AnetApi/xml/v1/schema/AnetApiSchema.xsd'中的元素'createCustomerProfileRequest'在名称空间'AnetApi/xml/v1/schema/AnetApiSchema.xsd'中具有无效的子元素'_xmlns'."

我要发送的json是:-

The json I'm sending is :-

{
  "createCustomerProfileRequest": {
    "merchantAuthentication": {
        "name": "name",
        "transactionKey": "transactionKey"
    },
    "refId": "1361101257555",
    "profile": {
        "merchantCustomerId": "2CLINC056",
        "description": "hiiiiii.",
        "email": "",
        "paymentProfiles": [
            {
                "customerType": "individual",
                "billTo": {
                    "firstName": "Joe",
                    "lastName": "Test",
                    "company": "CompanyA",
                    "address": "hello",
                    "city": "Bangalore",
                    "state": "Delhi",
                    "zip": "560078",
                    "country": "IN",
                    "phoneNumber": "415-555-1212",
                    "faxNumber": "415-555-1313"
                },
                "payment": {
                    "creditCard": {
                        "cardNumber": "370000000000002",
                        "expirationDate": "2029-12"
                    }
                }
            },
            {
                "customerType": "individual",
                "billTo": {
                    "firstName": "Joe",
                    "lastName": "Test",
                    "company": "CompanyA",
                    "address": "vel",
                    "city": "Chennai",
                    "state": "AK",
                    "zip": "560089",
                    "country": "US",
                    "phoneNumber": "415-555-1212",
                    "faxNumber": "415-555-1313"
                },
                "payment": {
                    "creditCard": {
                        "cardNumber": "38000000000006",
                        "expirationDate": "2029-12"
                    }
                }
            }
        ]
    },
    "validationMode": "testMode",
    "_xmlns": "AnetApi/xml/v1/schema/AnetApiSchema.xsd"
  }
}

Developer 链接

Developer link

推荐答案

我认为您的问题不在于支付配置文件,而在于JSON本身.您在那里有一个无效元素,我认为是这一行:

I think your issue is not with the payment profiles but with the JSON itself. You have an invalid element in there and I think it is this line:

"_xmlns": "AnetApi/xml/v1/schema/AnetApiSchema.xsd"

否则,您的请求就很好了,因为我能够使用类似的JSON创建多个付款资料.两者之间的唯一区别是我的JSON没有该行.

Otherwise your request looks fine as I was able to create multiple payment profiles using similar JSON. The only difference between the two was my JSON didn't have that line.

请求JSON:

{
  "createCustomerProfileRequest": {
    "merchantAuthentication": {
      "name": "xxxxxxxx",
      "transactionKey": "xxxxxxxxxxxxxxxx"
    },
    "profile": {
      "merchantCustomerId": "52353345",
      "email": "user@example.com",
      "paymentProfiles": [
        {
          "customerType": "individual",
          "billTo": {
            "firstName": "John",
            "lastName": "Smith",
            "address": "12345 Main Street",
            "city": "Townsville",
            "state": "NJ",
            "zip": "12345",
            "phoneNumber": "800-555-1234"
          },
          "payment": {
            "creditCard": {
              "cardNumber": "5555555555554444",
              "expirationDate": "2023-08"
            }
          }
        },
        {
          "customerType": "individual",
          "billTo": {
            "firstName": "John",
            "lastName": "Smithberg",
            "address": "42 Main Street",
            "city": "Townsville",
            "state": "NJ",
            "zip": "12345",
            "phoneNumber": "800-555-1234"
          },
          "payment": {
            "creditCard": {
              "cardNumber": "5105105105105100",
              "expirationDate": "2023-09"
            }
          }
        }
      ],
      "shipToList": {
        "firstName": "John",
        "lastName": "Smith",
        "address": "12345 Main Street",
        "city": "Townsville",
        "state": "NJ",
        "zip": "12345",
        "phoneNumber": "800-555-1234"
      }
    },
    "validationMode": "liveMode"
  }
}

响应JSON:

{
  "customerProfileId": "1506322353",
  "customerPaymentProfileIdList": [
    "1505667207",
    "1505667208"
  ],
  "customerShippingAddressIdList": [
    "1505655763"
  ],
  "validationDirectResponseList": [
    "1,1,1,This transaction has been approved.,A2FD5O,Y,40023515435,none,Test transaction for ValidateCustomerPaymentProfile.,0.00,CC,auth_only,52353345,John,Smith,,12345 Main Street,Townsville,NJ,12345,,800-555-1234,,user@example.com,,,,,,,,,0.00,0.00,0.00,FALSE,none,32573C7D03376A9052AACA73835EDAEF,P,2,,,,,,,,,,,XXXX4444,MasterCard,,,,,,,,,,,,,,,,,",
    "1,1,1,This transaction has been approved.,AO13Y1,Y,40023515436,none,Test transaction for ValidateCustomerPaymentProfile.,0.00,CC,auth_only,52353345,John,Smithberg,,42 Main Street,Townsville,NJ,12345,,800-555-1234,,user@example.com,,,,,,,,,0.00,0.00,0.00,FALSE,none,5B937D29D29F261776859B50DC1C3CF6,P,2,,,,,,,,,,,XXXX5100,MasterCard,,,,,,,,,,,,,,,,,"
  ],
  "messages": {
    "resultCode": "Ok",
    "message": [
      {
        "code": "I00001",
        "text": "Successful."
      }
    ]
  }
}

这篇关于添加客户多笔付款时如何解决名称空间中元素'createCustomerProfileRequest'的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆