Is it possible to make a partial refund multiple times? - authorize.net

Is it possible to make partial refund using Authorize.Net? E.g. I have a transaction by 300$. First time I need to make a refund 100$ on this transaction. And second time to make a refund 50$.
What kind of transaction status will be after that?
first request:
...
"refId": "123456",
"transactionRequest": {
"transactionType": "refundTransaction",
"amount": "100.00",}
"refTransId": "1234567890"
}
...
second request:
...
"refId": "123456",
"transactionRequest": {
"transactionType": "refundTransaction",
"amount": "50.00",}
"refTransId": "1234567890"
}
...

Yes, you can make multiple refunds against one transaction as long as you do not go over the original transaction amount.
Below I made a $50 payment and then following up with a $20 and $10 refund. Both were successful.
Here is my original AUTH_CAPTURE request:
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "",
"transactionKey": ""
},
"refId": 38947161,
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": 100,
"payment": {
"creditCard": {
"cardNumber": "4111111111111111",
"expirationDate": "122020",
"cardCode": "999"
}
},
"order": {
"invoiceNumber": "1324567890",
"description": "this is a test transaction"
},
"lineItems": {
"lineItem": [
{
"itemId": "1",
"name": "vase",
"description": "Cannes logo",
"quantity": "18",
"unitPrice": "45.00"
},
{
"itemId": "2",
"name": "desk",
"description": "Big Desk",
"quantity": "10",
"unitPrice": "85.00"
}
]
},
"tax": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"duty": {
"amount": "8.55",
"name": "duty name",
"description": "duty description"
},
"shipping": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"poNumber": "456654",
"customer": {
"id": "18",
"email": "someone#blackhole.tv"
},
"billTo": {
"firstName": "Ellen",
"lastName": "Johnson",
"company": "Souveniropolis",
"address": "14 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"shipTo": {
"firstName": "China",
"lastName": "Bayles",
"company": "Thyme for Tea",
"address": "12 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"customerIP": "192.168.1.1",
"transactionSettings": {
"setting": [
{
"settingName": "allowPartialAuth",
"settingValue": "false"
},
{
"settingName": "duplicateWindow",
"settingValue": "0"
},
{
"settingName": "emailCustomer",
"settingValue": "false"
},
{
"settingName": "recurringBilling",
"settingValue": "false"
},
{
"settingName": "testRequest",
"settingValue": "false"
}
]
},
"userFields": {
"userField": {
"name": "favorite_color",
"value": "blue"
}
}
}
}
}
Here is my original AUTH_CAPTURE response:
{
"transactionResponse": {
"responseCode": "1",
"authCode": "TTJ26B",
"avsResultCode": "Y",
"cvvResultCode": "P",
"cavvResultCode": "2",
"transId": "40032153203",
"refTransID": "",
"transHash": "",
"testRequest": "0",
"accountNumber": "XXXX1111",
"accountType": "Visa",
"messages": [
{
"code": "1",
"description": "This transaction has been approved."
}
],
"userFields": [
{
"name": "favorite_color",
"value": "blue"
}
],
"transHashSha2": "0C9E5A47F93CD5B770A6B4AB24FE0F0D6F3B909066C72A10C4746F48C9886527A18B654736AE8D920D9048A14F2823A0DEC5B5F775A1C48DE9CBCF41C8D28CA3",
"SupplementalDataQualificationIndicator": 0
},
"refId": "38947161",
"messages": {
"resultCode": "Ok",
"message": [
{
"code": "I00001",
"text": "Successful."
}
]
}
}
Here is my first REFUND request (successful):
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "",
"transactionKey": ""
},
"refId": 30777668,
"transactionRequest": {
"transactionType": "refundTransaction",
"amount": 20,
"payment": {
"creditCard": {
"cardNumber": "4111111111111111",
"expirationDate": "122020"
}
},
"authCode": "40032153203"
}
}
}
Here is my first REFUND response (successful):
{
"transactionResponse": {
"responseCode": "1",
"authCode": "",
"avsResultCode": "P",
"cvvResultCode": "",
"cavvResultCode": "",
"transId": "40032153314",
"refTransID": "",
"transHash": "",
"testRequest": "0",
"accountNumber": "XXXX1111",
"accountType": "Visa",
"messages": [
{
"code": "1",
"description": "This transaction has been approved."
}
],
"transHashSha2": "4CE2D83B56C09494AD5609440E3337A6DEE0F4C74FBC99B218D65F6A121EFFC269F8954AC47C17B3B739E61A860C7B0818A8497D85D314D6E0CD89C9FE71A071",
"SupplementalDataQualificationIndicator": 0
},
"refId": "30777668",
"messages": {
"resultCode": "Ok",
"message": [
{
"code": "I00001",
"text": "Successful."
}
]
}
}
Here is my second REFUND request (successful):
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "",
"transactionKey": ""
},
"refId": 40597686,
"transactionRequest": {
"transactionType": "refundTransaction",
"amount": 10,
"payment": {
"creditCard": {
"cardNumber": "4111111111111111",
"expirationDate": "122020"
}
},
"authCode": "40032153203"
}
}
}
Here is my second REFUND response (successful):
{
"transactionResponse": {
"responseCode": "1",
"authCode": "",
"avsResultCode": "P",
"cvvResultCode": "",
"cavvResultCode": "",
"transId": "40032153319",
"refTransID": "",
"transHash": "",
"testRequest": "0",
"accountNumber": "XXXX1111",
"accountType": "Visa",
"messages": [
{
"code": "1",
"description": "This transaction has been approved."
}
],
"transHashSha2": "FD146FC0F8F3F31068905EC6C8D252662AA735ACDFAC53B4A8D808060C244C06288700AA8872466C3E240B62130D010CFBDE0473D09B631514A6E2E2CB77804F",
"SupplementalDataQualificationIndicator": 0
},
"refId": "40597686",
"messages": {
"resultCode": "Ok",
"message": [
{
"code": "I00001",
"text": "Successful."
}
]
}
}

Related

Wrong geocode results

We're trying to geocode a location in Poland, using a street, zip code and a city name, but seem to get wrong result. We're looking for: DĄBROWSKIEGO , 82-300 ELBLĄG
Request:
https://geocoder.ls.hereapi.com/6.2/geocode.json?apiKey={API_KEY}&searchtext=D%C4%84BROWSKIEGO%2B,%2B82-300%2BELBL%C4%84G
Instead of a road of that name in the city of Elbląg we get a street of the same name in Poznań:
{
"Response": {
"MetaInfo": {
"Timestamp": "2021-05-11T10:40:48.113+0000"
},
"View": [
{
"Result": [
{
"Relevance": 0.65,
"MatchLevel": "houseNumber",
"MatchQuality": {
"Street": [
0.5
],
"HouseNumber": 1.0
},
"MatchType": "pointAddress",
"Location": {
"LocationId": "here:af:streetsection:nKjv5QtDTbhcQ-QErVaJvA:CgcIBCDCwO9pEAEaAzMwMA",
"LocationType": "point",
"DisplayPosition": {
"Latitude": 52.42663,
"Longitude": 16.85675
},
"NavigationPosition": [
{
"Latitude": 52.42678,
"Longitude": 16.85687
}
],
"MapView": {
"TopLeft": {
"Latitude": 52.42753,
"Longitude": 16.85528
},
"BottomRight": {
"Latitude": 52.42573,
"Longitude": 16.85822
}
},
"Address": {
"Label": "ulica gen. Jana H. Dąbrowskiego 300, 60-406 Poznań, Polska",
"Country": "POL",
"State": "Woj. Wielkopolskie",
"County": "Poznań",
"City": "Poznań",
"District": "Poznań",
"Subdistrict": "Jeżyce",
"Street": "ulica gen. Jana H. Dąbrowskiego",
"HouseNumber": "300",
"PostalCode": "60-406",
"AdditionalData": [
{
"value": "Polska",
"key": "CountryName"
},
{
"value": "Woj. Wielkopolskie",
"key": "StateName"
},
{
"value": "Poznań",
"key": "CountyName"
}
]
}
}
}
],
"ViewId": 0
}
]
}
}
Trying to use newer api gives the same results:
https://geocode.search.hereapi.com/v1/geocode?apiKey={API_KEY}&q=D%C4%84BROWSKIEGO%2B,%2B82-300%2BELBL%C4%84G
{
"items": [
{
"title": "ulica gen. Jana H. Dąbrowskiego 300, 60-406 Poznań, Polska",
"id": "here:af:streetsection:nKjv5QtDTbhcQ-QErVaJvA:CgcIBCDCwO9pEAEaAzMwMA",
"resultType": "houseNumber",
"houseNumberType": "PA",
"address": {
"label": "ulica gen. Jana H. Dąbrowskiego 300, 60-406 Poznań, Polska",
"countryCode": "POL",
"countryName": "Polska",
"state": "Woj. Wielkopolskie",
"county": "Poznań",
"city": "Poznań",
"district": "Poznań",
"subdistrict": "Jeżyce",
"street": "ulica gen. Jana H. Dąbrowskiego",
"postalCode": "60-406",
"houseNumber": "300"
},
"position": {
"lat": 52.42663,
"lng": 16.85675
},
"access": [
{
"lat": 52.42678,
"lng": 16.85687
}
],
"mapView": {
"west": 16.85528,
"south": 52.42573,
"east": 16.85822,
"north": 52.42753
},
"scoring": {
"queryScore": 0.65,
"fieldScore": {
"streets": [
0.5
],
"houseNumber": 1.0
}
}
}
]
}
Looking for a different street in the city of Elbląg gives us proper result:
Łęczycka, 82-300 ELBLĄG
https://geocoder.ls.hereapi.com/6.2/geocode.json?apiKey={API_KEY}&searchtext=%C5%81%C4%99czycka%2B,%2B82-300%2BELBL%C4%84G
{
"Response": {
"MetaInfo": {
"Timestamp": "2021-05-11T10:43:15.578+0000"
},
"View": [
{
"Result": [
{
"Relevance": 0.99,
"MatchLevel": "street",
"MatchQuality": {
"City": 1.0,
"Street": [
0.9
],
"PostalCode": 1.0
},
"Location": {
"LocationId": "here:af:street:SHP1-8Tzm6jtHKMvaFxTLA",
"LocationType": "point",
"DisplayPosition": {
"Latitude": 54.16571,
"Longitude": 19.46824
},
"NavigationPosition": [
{
"Latitude": 54.16571,
"Longitude": 19.46824
}
],
"MapView": {
"TopLeft": {
"Latitude": 54.17117,
"Longitude": 19.43421
},
"BottomRight": {
"Latitude": 54.15544,
"Longitude": 19.50485
}
},
"Address": {
"Label": "ulica Łęczycka, 82-300 Elbląg, Polska",
"Country": "POL",
"State": "Woj. Warmińsko-Mazurskie",
"County": "Elbląg",
"City": "Elbląg",
"District": "Elbląg",
"Street": "ulica Łęczycka",
"PostalCode": "82-300",
"AdditionalData": [
{
"value": "Polska",
"key": "CountryName"
},
{
"value": "Woj. Warmińsko-Mazurskie",
"key": "StateName"
},
{
"value": "Elbląg",
"key": "CountyName"
}
]
}
}
}
],
"ViewId": 0
}
]
}
}
Is there anything we're doing wrong when invoking the requests?
Now it returns correct results:
https://geocoder.ls.hereapi.com/6.2/geocode.json?language=en-US&maxresults=20&searchtext=D%C4%84BROWSKIEGO+82-300+ELBL%C4%84G&apikey=***
Result:
{
"Response": {
"MetaInfo": {
"Timestamp": "2021-07-20T12:23:56.560+0000"
},
"View": [
{
"_type": "SearchResultsViewType",
"ViewId": 0,
"Result": [
{
"Relevance": 1,
"MatchLevel": "street",
"MatchQuality": {
"City": 1,
"Street": [
0.57
],
"PostalCode": 1
},
"Location": {
"LocationId": "NT_mqHTX7fWyBVgpiaYyp.VAB",
"LocationType": "point",
"DisplayPosition": {
"Latitude": 54.15047,
"Longitude": 19.45583
},
"NavigationPosition": [
{
"Latitude": 54.15047,
"Longitude": 19.45583
}
],
"MapView": {
"TopLeft": {
"Latitude": 54.15449,
"Longitude": 19.44247
},
"BottomRight": {
"Latitude": 54.15029,
"Longitude": 19.46051
}
},
"Address": {
"Label": "ulica gen. Jarosława Dąbrowskiego, 82-300 Elbląg, Poland",
"Country": "POL",
"State": "Woj. Warmińsko-Mazurskie",
"County": "Elbląg",
"City": "Elbląg",
"District": "Elbląg",
"Street": "ulica gen. Jarosława Dąbrowskiego",
"PostalCode": "82-300",
"AdditionalData": [
{
"value": "Poland",
"key": "CountryName"
},
{
"value": "Woj. Warmińsko-Mazurskie",
"key": "StateName"
},
{
"value": "Elbląg",
"key": "CountyName"
}
]
}
}
}
]
}
]
}
}
This GS7 request
https://search.hereapi.com/v1/geocode?q=D%C4%84BROWSKIEGO+82-300+ELBL%C4%84G&at=51.9206796%2C17.2954345&lang=en-US&limit=20&apikey=***
returns incorrect result - but will be fixed soon.

How to Implement Partial Auth on Authorize.net API [duplicate]

Okay I am setting up Partial Payments via the Authorize.net API in order to enable multiple cards to be used to cover a single balance/charge.
I'm assuming thier Partial Auth feature covers my use case, but in testing, there is an issue I can show you using the API live console here: https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card
Go to the link above and authorize partial payments with the request I edited below and you will notice when you press submit you get a splitTenderId:
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "5KP3u95bQpv",
"transactionKey": "346HZ32z3fP4hTG2"
},
"refId": "123456",
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": "462.25",
"payment": {
"creditCard": {
"cardNumber": "5424000000000015",
"expirationDate": "2020-12",
"cardCode": "999"
}
},
"lineItems": {
"lineItem": {
"itemId": "1",
"name": "vase",
"description": "Cannes logo",
"quantity": "18",
"unitPrice": "45.00"
}
},
"tax": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"duty": {
"amount": "8.55",
"name": "duty name",
"description": "duty description"
},
"shipping": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"poNumber": "456654",
"customer": {
"id": "99999456654"
},
"billTo": {
"firstName": "Ellen",
"lastName": "Johnson",
"company": "Souveniropolis",
"address": "14 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"shipTo": {
"firstName": "China",
"lastName": "Bayles",
"company": "Thyme for Tea",
"address": "12 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"customerIP": "192.168.1.1",
"transactionSettings": {
"setting": [
{
"settingName": "emailCustomer",
"settingValue": "true"
}, {
"settingName": "allowPartialAuth",
"settingValue": "true"
},
]
},
"userFields": {
"userField": [
{
"name": "MerchantDefinedFieldName1",
"value": "MerchantDefinedFieldValue1"
},
{
"name": "favorite_color",
"value": "blue"
}
]
}
}
}
}
This is only successful because the amount is 462.25 as the docs say to use for testing, if I use any other (real) amount the splitTenderId is not there.
Here is a new example request, you can post this again on the link above:
{
"createTransactionRequest": {
"merchantAuthentication": {
"name": "5KP3u95bQpv",
"transactionKey": "346HZ32z3fP4hTG2"
},
"refId": "123456",
"transactionRequest": {
"transactionType": "authCaptureTransaction",
"amount": "462",
"payment": {
"creditCard": {
"cardNumber": "5424000000000015",
"expirationDate": "2020-12",
"cardCode": "999"
}
},
"lineItems": {
"lineItem": {
"itemId": "1",
"name": "vase",
"description": "Cannes logo",
"quantity": "18",
"unitPrice": "45.00"
}
},
"tax": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"duty": {
"amount": "8.55",
"name": "duty name",
"description": "duty description"
},
"shipping": {
"amount": "4.26",
"name": "level2 tax name",
"description": "level2 tax"
},
"poNumber": "456654",
"customer": {
"id": "99999456654"
},
"billTo": {
"firstName": "Ellen",
"lastName": "Johnson",
"company": "Souveniropolis",
"address": "14 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"shipTo": {
"firstName": "China",
"lastName": "Bayles",
"company": "Thyme for Tea",
"address": "12 Main Street",
"city": "Pecan Springs",
"state": "TX",
"zip": "44628",
"country": "USA"
},
"customerIP": "192.168.1.1",
"transactionSettings": {
"setting": [
{
"settingName": "emailCustomer",
"settingValue": "true"
}, {
"settingName": "allowPartialAuth",
"settingValue": "true"
},
]
},
"userFields": {
"userField": [
{
"name": "MerchantDefinedFieldName1",
"value": "MerchantDefinedFieldValue1"
},
{
"name": "favorite_color",
"value": "blue"
}
]
}
}
}
}
And with the 462 amount entered this is no longer a partial auth payment and I no longer get a splitTenderId.
Can someone please help me figure out what is going on?

How to solve the error of The element 'createCustomerProfileRequest' in namespace while adding the customer mutiple payment

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
"The element 'createCustomerProfileRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element '_xmlns' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
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 link
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"
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.
Request 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"
}
}
Response 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."
}
]
}
}

How to create payment profile with the create transaction request on Authorize.net

I would like to create the payment profile with the createTransactionRequest.
Here are the request parameters that i am passing.
{
"createTransactionRequest":{
"merchantAuthentication":{
"name":"***",
"transactionKey":"***"
},
"transactionRequest":{
"transactionType":"authCaptureTransaction",
"amount":"4.95",
"payment":{
"creditCard":{
"cardNumber":"5424000000000015",
"expirationDate":"1217",
"cardCode":123
}
},
"billTo":{
"firstName":"first name",
"lastName":"last name",
"address":"test address",
"city":"test city",
"state":"TX",
"zip":"12345",
"country":"USA"
},
"profile":{
"createProfile":true
}
}
}
}
and here is the response error.
{
"messages":{
"resultCode":"Error",
"message":[
{
"code":"E00003",
"text":"The element 'transactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'profile' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'shipTo, customerIP, cardholderAuthentication, retail, employeeId, transactionSettings, userFields, surcharge, merchantDescriptor, subMerchant, tip' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."
}
]
}
}
The order of the fields in your request matter. They must match what is in the documentation. That means that field needs to come before the billTo field in your JSON:
{
"createTransactionRequest":{
"merchantAuthentication":{
"name":"***",
"transactionKey":"***"
},
"transactionRequest":{
"transactionType":"authCaptureTransaction",
"amount":"4.95",
"payment":{
"creditCard":{
"cardNumber":"5424000000000015",
"expirationDate":"1217",
"cardCode":123
}
},
"profile":{
"createProfile":true
},
"billTo":{
"firstName":"first name",
"lastName":"last name",
"address":"test address",
"city":"test city",
"state":"TX",
"zip":"12345",
"country":"USA"
},
}
}
}
This request yields me this response:
{
"transactionResponse": {
"responseCode": "1",
"authCode": "Y77MQH",
"avsResultCode": "Y",
"cvvResultCode": "P",
"cavvResultCode": "2",
"transId": "40007520179",
"refTransID": "",
"transHash": "94D188D090B695D7C6D47D9293840BE3",
"testRequest": "0",
"accountNumber": "XXXX0015",
"accountType": "MasterCard",
"messages": [
{
"code": "1",
"description": "This transaction has been approved."
}
],
"transHashSha2": "9768048279544EDB22BAAAC194CA3EDBA705FBC569AC9555F3A2A86E545938849CEB2D9519885A4CC69328BBB7DDC36E0852998CAD5FAC1F6CA6427599E3493B"
},
"profileResponse": {
"messages": {
"resultCode": "Error",
"message": [
{
"code": "E00102",
"text": "Customer Info is missing."
}
]
}
},
"messages": {
"resultCode": "Ok",
"message": [
{
"code": "I00001",
"text": "Successful."
}
]
}
}
Looks like you need to add the id field in the customer section:
{
"createTransactionRequest":{
"merchantAuthentication":{
"name":"***",
"transactionKey":"***"
},
"transactionRequest":{
"transactionType":"authCaptureTransaction",
"amount":"4.95",
"payment":{
"creditCard":{
"cardNumber":"5424000000000015",
"expirationDate":"1217",
"cardCode":123
}
},
"profile":{
"createProfile":true
},
"customer":{
"id":<yourIdForThisUser>
},
"billTo":{
"firstName":"first name",
"lastName":"last name",
"address":"test address",
"city":"test city",
"state":"TX",
"zip":"12345",
"country":"USA"
},
}
}
}
That yields:
{
"transactionResponse": {
"responseCode": "1",
"authCode": "SCSVNX",
"avsResultCode": "Y",
"cvvResultCode": "P",
"cavvResultCode": "2",
"transId": "40007520393",
"refTransID": "",
"transHash": "DFB7FE5B8D3FAFE0A18A6B5C125838A3",
"testRequest": "0",
"accountNumber": "XXXX0015",
"accountType": "MasterCard",
"messages": [
{
"code": "1",
"description": "This transaction has been approved."
}
],
"transHashSha2": "57C6A161A948E5A7F5303FCD2FE8CDF3E1D3C38B989161675D47FD61526F3DA9EDBD497169F978860B78A2C5FEC1B6E54807086DF4B0CE346538DDDD9E25C4A8"
},
"profileResponse": {
"messages": {
"resultCode": "Ok",
"message": [
{
"code": "I00001",
"text": "Successful."
}
]
},
"customerProfileId": "1502546960",
"customerPaymentProfileIdList": [
"1502081232"
],
"customerShippingAddressIdList": []
},
"messages": {
"resultCode": "Ok",
"message": [
{
"code": "I00001",
"text": "Successful."
}
]
}
}

Hypen in response data is throwing error when setting as global variable for nested response

I have a post man request. Which returns a response data as:
[
{
"id": "7ca27c09-2b67-417e-b367-f97d49824a2f",
"tags": [],
"type": "ApplicationProfile",
"userId": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"profile": {
"User-Profile": {
"PHI": {
"gender": "Male",
"surgeryDate": {
"value": "2017-06-06"
},
"surgeryType": {
"value": "gastricBand"
},
"heightInches": "72",
"approvalPhase": "2",
"profileImageUrl": "",
"motivationalImageUrl": ""
},
"PII": {
"mail": "c11#c111.com",
"lastName": "",
"firstName": "name1",
"shouldReceiveNotifications": true
}
},
"motivationalGoals": [
{
"goal": "Improving health",
"goalId": "2957"
},
{
"goal": "Relieving pain",
"goalId": "2958"
},
{
"goal": "Feeling better",
"goalId": "2960"
}
]
},
"version": 35,
"createdBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"lastModifiedBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"applicationName": "Health Partner",
"createdDateTime": "2017-06-08T16:08:32.497Z",
"lastModifiedDateTime": "2017-06-09T13:23:03.503Z"
},
{
"id": "091b5ebd-b096-436e-a703-f97f0ae77baf",
"tags": [
"Application-Profile"
],
"type": "ApplicationProfile",
"userId": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"profile": {
"User-Profile": {
"PHI": {
"gender": "",
"surgeryDate": {
"value": "2017-06-01"
},
"surgeryType": {
"value": ""
},
"heightInches": "72",
"approvalPhase": "2",
"profileImageUrl": "",
"motivationalImageUrl": ""
},
"PII": {
"mail": "c11#c111.com",
"lastName": "Dev",
"firstName": "Kat",
"shouldReceiveNotifications": true
}
},
"motivationalGoals": [
{
"goal": "Improving health",
"goalId": "2957"
},
{
"goal": "Relieving pain",
"goalId": "2958"
},
{
"goal": "Feeling better",
"goalId": "2960"
}
]
},
"version": 41,
"createdBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"lastModifiedBy": "2f2c8684-874d-49ea-bfa4-977069c1e3e2",
"applicationName": "Health Partner Weightloss",
"createdDateTime": "2017-06-03T16:19:57.811Z",
"lastModifiedDateTime": "2017-06-08T16:07:49.555Z"
}
]
I need to extract the value of the emailid and set as global variable.
here is my code:
var jsonData1 = JSON.parse(responseBody);
postman.setGlobalVariable("jsonData1",jsonData1.profile.User-Profile.PII.mail);
But I am getting error. "User is undefined".
The problem here is that the hyphen / minus sign is interpreted as the subtraction operator.
Consider changing your API and using "userProfile" instead of "User-Profile".