{"metadata":{"image":[],"title":"","description":""},"api":{"url":"/batch-transactions","auth":"optional","settings":"57ee593a21ceb20e0061959e","results":{"codes":[{"code":"","language":"text"}]},"params":[],"examples":{"codes":[]},"method":"post"},"next":{"description":"","pages":[]},"title":"Create Batch Transaction","type":"endpoint","slug":"create-batch-transaction","excerpt":"","body":"The Create Batch Transaction request enables you to process multiple transactions at once, including credit card transactions (Auth Capture only), ACH/ECP, SEPA, and PayPal recurring transactions.\n\nThe request includes multiple `cardTransaction` and/or `altTransaction` resources; a unique batch ID that you define; and a callback URL pointing to where you would like the status of the batch transaction to be sent after processing. \n\nThe API sends an immediate response to the Create Batch Transaction request and then the individual transactions in the request are processed. Once all transactions are processed, BlueSnap sends the full batch result to the callback URL you provided in the request. Some of the transactions may be successfully processed and some may fail. However, as long as the batch file was successfully processed, the callback status of the batch will be `completed`. For an example of the batch result that is sent to your callback URL after the transactions have been processed, see [Example Batch Result](https://developers.bluesnap.com/v8976-JSON/docs/batch-processing-tutorial#section-example-batch-result).\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Transaction limit per batch\",\n  \"body\": \"There is a limit of 2000 transactions per batch.\"\n}\n[/block]\n<a class=\"btn btn-success\" href=\"#section-api-explorer\" role=\"button\">Try it in the API Explorer</a>\n\n###Request Content\n`batchTransaction` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>, contains the following properties (see [batchTransaction](doc:batch-transaction) ):\n&nbsp;&nbsp;&nbsp;`batchId` *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n&nbsp;&nbsp;&nbsp;`callbackUrl` *string* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required**</span>\n&nbsp;&nbsp;&nbsp;`cardTransaction` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required** for credit card transactions</span> (see [card-transaction](doc:cardTransaction))\n&nbsp;&nbsp;&nbsp;`altTransaction` *container* &nbsp;&nbsp;&nbsp;<span style=\"color:#F37500\">**required** for ACH/ECP, SEPA, or PayPal transactions</span> (see [altTransaction](doc:alt-transaction))\n\n###Response Details\nIf successful, the response HTTP status code is 201 Created.\nNote that if an error occurs, the error format is slightly different from other error types. See [Batch transaction errors](doc:batch-errors).\nFor an example of the batch result that is sent to your callback URL after the transactions have been processed, see [Example Batch Result](https://developers.bluesnap.com/v8976-JSON/docs/batch-processing-tutorial#section-example-batch-result).\n\n<hr>\n\n##Examples\n\n###Request Examples\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"batchId\\\": \\\"PKB0042\\\",\\n    \\\"callbackUrl\\\": \\\"http://example.com/batch_callback \\\",\\n    \\\"cardTransaction\\\": [{\\n        \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n        \\\"merchantTransactionId\\\": \\\"566\\\",\\n        \\\"amount\\\": 20.00,\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"cardHolderInfo\\\": {\\n            \\\"firstName\\\": \\\"Joe\\\",\\n            \\\"lastName\\\": \\\"Example\\\"\\n        },\\n        \\\"creditCard\\\": {\\n            \\\"cardNumber\\\": \\\"4263982640269299\\\",\\n            \\\"expirationMonth\\\": \\\"02\\\",\\n            \\\"expirationYear\\\": \\\"2023\\\"\\n        }\\n    },{\\n        \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n        \\\"merchantTransactionId\\\": \\\"567\\\",\\n        \\\"amount\\\": 25.00,\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"cardHolderInfo\\\": {\\n            \\\"firstName\\\": \\\"Jane\\\",\\n            \\\"lastName\\\": \\\"Shopper\\\"\\n        },\\n        \\\"creditCard\\\": {\\n            \\\"cardNumber\\\": \\\"4111111111111111\\\",\\n            \\\"expirationMonth\\\": \\\"07\\\",\\n            \\\"expirationYear\\\": \\\"2023\\\"\\n        }\\n    }]\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"Create Batch Transaction Request: basic\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"batchId\\\": \\\"PKB0043\\\",\\n    \\\"callbackUrl\\\": \\\"http://example.com/batch_callback \\\",\\n    \\\"cardTransaction\\\": [{\\n        \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n        \\\"merchantTransactionId\\\": \\\"566\\\",\\n        \\\"amount\\\": 11.00,\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"vaultedShopperId\\\": 19596516\\n    },{\\n        \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n        \\\"merchantTransactionId\\\": \\\"567\\\",\\n        \\\"amount\\\": 12.00,\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"vaultedShopperId\\\": 19596754,\\n        \\\"creditCard\\\": {\\n            \\\"cardLastFourDigits\\\": \\\"9299\\\"\\n        }\\n    }]\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"with vaulted shoppers\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"batchId\\\": \\\"PKB0044\\\",\\n    \\\"callbackUrl\\\": \\\"http://example.com/batch_callback \\\",\\n    \\\"altTransaction\\\": [{\\n        \\\"amount\\\": 100.00,\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"paypalTransaction\\\": {\\n            \\\"paypalSubscriptionId\\\": 22758655\\n        }\\n    }]\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"with PayPal recurring subscription payment\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"batchId\\\": \\\"PKB0045\\\",\\n    \\\"callbackUrl\\\": \\\"http://example.com/batch_callback \\\",\\n    \\\"cardTransaction\\\": [{\\n        \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n        \\\"merchantTransactionId\\\": \\\"566\\\",\\n        \\\"amount\\\": 20.00,\\n        \\\"currency\\\": \\\"USD\\\",\\n        \\\"cardHolderInfo\\\": {\\n            \\\"firstName\\\": \\\"Joe\\\",\\n            \\\"lastName\\\": \\\"Example\\\"\\n        },\\n        \\\"creditCard\\\": {\\n            \\\"encryptedCardNumber\\\": \\\"$bsjs_1_0_4$BFxgRNbmuILoOGnT+GRqSKUw51ZEwJbaMNVZhSg1vxqaQlk4W3SbO0VE/yMiSUSwff9r08FDm//mY6RUv7i/IpmkgIfQJUhw09vohKzZF0OwPdD4xKX3DP+ZNwDWkI5655hQuAZJz3n/VFo22v4zJu4ZliFujDT9tjq/UjzlNgwMkIgGUa/0Zh6HG2MJWjGU8X0RZI/3aCTq7T/r3qeDWLOko10bHLQ1/YdLIw9LsWAOQfHMvMRB+fx+adFuvAGQfl3KFU9S43ME0IG32O9XhjWdJ8yv6bMa9MScpbeYuWH4lfIZNu3Je+H9coNZtMoY3zHZIAcHhjGcsWpTfTltew==$B3TT62QoCueWA4HoqrSwe+flRtEipADuQMy0XGfdaWHMy8ay6fa8sp8wA7rzxDJv$FYRb0yVz2fTvWemafDpeV1UPxezJkTQTYvdaGlJ5nJU=\\\",\\n            \\\"cardType\\\": \\\"VISA\\\",\\n            \\\"expirationMonth\\\": \\\"02\\\",\\n            \\\"expirationYear\\\": \\\"2023\\\"\\n        }\\n    }]\\n}'\",\n      \"language\": \"curl\",\n      \"name\": \"with encrypted card details\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"batchId\\\": \\\"PKB0061\\\",\\n    \\\"callbackUrl\\\": \\\"http://example.com/batch_callback \\\",\\n    \\\"cardTransaction\\\": [\\n        {\\n            \\\"cardTransactionType\\\": \\\"AUTH_CAPTURE\\\",\\n            \\\"merchantTransactionId\\\": \\\"566\\\",\\n            \\\"softDescriptor\\\": \\\"DescTest txn1\\\",\\n            \\\"amount\\\": 11.00,\\n            \\\"currency\\\": \\\"USD\\\",\\n            \\\"cardHolderInfo\\\": {\\n                \\\"firstName\\\": \\\"John\\\",\\n                \\\"lastName\\\": \\\"Doe\\\"\\n            },\\n            \\\"creditCard\\\": {\\n                \\\"cardNumber\\\": \\\"4263982640269299\\\",\\n                \\\"expirationMonth\\\": \\\"02\\\",\\n                \\\"expirationYear\\\": \\\"2023\\\"\\n            }\\n        }\\n    ],\\n    \\\"altTransaction\\\": [\\n        {\\n            \\\"softDescriptor\\\": \\\"ABC COMPANY\\\",\\n            \\\"amount\\\": 100.00,\\n            \\\"currency\\\": \\\"USD\\\",\\n            \\\"payerInfo\\\": {\\n                \\\"firstName\\\": \\\"John\\\",\\n                \\\"lastName\\\": \\\"Doe\\\",\\n                \\\"zip\\\" : \\\"12345\\\",\\n                \\\"phone\\\": \\\"1234567890\\\"\\n            },\\n            \\\"ecpTransaction\\\": {\\n                \\\"accountNumber\\\": \\\"4099999992\\\",\\n                \\\"routingNumber\\\": \\\"011075150\\\",\\n                \\\"accountType\\\": \\\"CONSUMER_CHECKING\\\"\\n            },\\n            \\\"authorizedByShopper\\\": \\\"true\\\"\\n        },\\n        {\\n            \\\"softDescriptor\\\": \\\"SepaPapi\\\",\\n            \\\"amount\\\": 20.00,\\n            \\\"currency\\\": \\\"EUR\\\",\\n            \\\"payerInfo\\\": {\\n                \\\"firstName\\\": \\\"John\\\",\\n                \\\"lastName\\\": \\\"Doe\\\",\\n                \\\"phone\\\": \\\"23123133213\\\",\\n                \\\"zip\\\" : \\\"45353434\\\",\\n                \\\"country\\\": \\\"IT\\\",\\n                \\\"state\\\": \\\"ca\\\",\\n                \\\"city\\\": \\\"London\\\",\\n                \\\"address\\\": \\\"green line 21\\\"\\n            },\\n            \\\"sepaDirectDebitTransaction\\\": {\\n                \\\"iban\\\": \\\"DE09100100101234567891\\\",\\n                \\\"bic\\\": \\\"PBNKDEFFXXX\\\"\\n            },\\n            \\\"authorizedByShopper\\\": \\\"true\\\"\\n        }\\n    ]\\n}\",\n      \"language\": \"curl\",\n      \"name\": \"with multiple alt types\"\n    },\n    {\n      \"code\": \"curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \\\\\\n-H 'Content-Type: application/json' \\\\\\n-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \\\\\\n-d '\\n{\\n    \\\"batchId\\\": \\\"PKB0035\\\",\\n    \\\"callbackUrl\\\": \\\"http://example.com/batch_callback \\\",\\n    \\\"cardTransaction\\\": [{\\n        \\\"cardTransactionType\\\": \\\"CAPTURE\\\",\\n        \\\"transactionId\\\": \\\"38591014\\\",\\n        \\\"merchantTransactionId\\\": \\\"1\\\"\\n    }]\\n}\",\n      \"language\": \"curl\",\n      \"name\": \"with CAPTURE cardTransactionType\"\n    }\n  ]\n}\n[/block]\n###Response Example\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"HTTP/ 1.1 201 Created\",\n      \"language\": \"http\",\n      \"name\": \"Create Batch Transaction Response: 201 Created\"\n    }\n  ]\n}\n[/block]\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n\n<hr>\n\n##Example Descriptions\nFor details about the above examples, see:\n  * [Basic Create Batch Transaction](create-batch-transaction#section-basic-create-batch-transaction)\n  * [Create Batch Transaction with vaulted shoppers](create-batch-transaction#section-create-batch-transaction-with-vaulted-shoppers)\n  * [Create Batch Transaction with PayPal recurring subscription payment](create-batch-transaction#section-create-batch-transaction-with-paypal-recurring-subscription-payment)\n  * [Create Batch Transaction with encrypted card details](create-batch-transaction#section-create-batch-transaction-with-encrypted-card-details)\n \n###Basic Create Batch Transaction\nThis example shows a basic Create Batch Transaction request, containing two `cardTransaction` resources with the required fields to process a credit card payment. \n\nNote that within each `cardTransaction` resource you can use any of the options available for a single [Auth Capture](doc:auth-capture) or [Create PayPal Transaction](doc:create-paypal-transaction) (recurring subscription payment only) request, such as using a vaulted shopper, sending encrypted card information, including metadata, and so on. \n\n###Create Batch Transaction with vaulted shoppers\nTo perform a Create Batch Transaction request with existing vaulted shoppers, you'll need to include the `vaultedShopperId` property within the `cardTransaction` or `altTransaction` resources in your request.\n\nRemember to include the card's last four digits if multiple cards are saved for the shopper.\n\nAbove is an example of a request with a vaulted shopper ID within each `cardTransaction` resource.\n\n###Create Batch Transaction with PayPal recurring subscription payment\nTo perform batch transactions with PayPal payments for subscriptions, you will need to send the  `altTransaction` resource in your request, and include in it the `paypalTransaction` resource, with the `paypalSubscriptionId` element.\n\nThe request should contain only one transaction per unique `paypalSubscriptionId`.\n\nOn the right is an example of a request with one PayPal subscription transaction.\n\nFor more information, see [Merchant-managed PayPal subscriptions](doc:subscription-management#section-processing-merchant-managed-paypal-subscription-payments).\n\n###Create Batch Transaction with encrypted card details\nYour PCI compliance requirements and API permission level may require that you send credit card data in encrypted format only. To do this, you'll need to include the `encryptedCardNumber` and `encryptedSecurityCode` properties within the `cardTransaction` resources in your request.\n\nOn the right is an example of a request with encrypted credit card numbers within each `cardTransaction` resource.\n\n<br>\n<a class=\"btn btn-primary\" href=\"#\" role=\"button\">Back to Top</a>\n\n<hr>\n\n##API Explorer\nTo test out a call, enter the JSON portion of the request below and then click **Try it!**\nIn order to get a successful response, you must enter a unique batch ID in the `batchId` property.\n\n**Tip**: Copy the JSON portion from one of the example requests above, or use the JSON code below as a starting point. You can enter different parameters and  test credit card numbers to see how your test scenario would work. *The request headers, including authorization, are already built in for you in this test area, so you should not include them here.*\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n   \\\"batch-transaction\\\": {\\n      \\\"batch-id\\\": \\\"567890\\\",\\n      \\\"callback-url\\\": \\\"http://example.com/batch_callback\\\",\\n      \\\"card-transaction\\\": [\\n         {\\n            \\\"card-transaction-type\\\": \\\"AUTH_CAPTURE\\\",\\n            \\\"merchant-transaction-id\\\": \\\"566\\\",\\n            \\\"amount\\\": \\\"20.00\\\",\\n            \\\"currency\\\": \\\"USD\\\",\\n            \\\"card-holder-info\\\": {\\n               \\\"first-name\\\": \\\"Joe\\\",\\n               \\\"last-name\\\": \\\"Example\\\"\\n            },\\n            \\\"credit-card\\\": {\\n               \\\"card-number\\\": \\\"4263982640269299\\\",\\n               \\\"expiration-month\\\": \\\"02\\\",\\n               \\\"expiration-year\\\": \\\"2023\\\"\\n            }\\n         },\\n         {\\n            \\\"card-transaction-type\\\": \\\"AUTH_CAPTURE\\\",\\n            \\\"merchant-transaction-id\\\": \\\"567\\\",\\n            \\\"amount\\\": \\\"25.00\\\",\\n            \\\"currency\\\": \\\"USD\\\",\\n            \\\"card-holder-info\\\": {\\n               \\\"first-name\\\": \\\"Jane\\\",\\n               \\\"last-name\\\": \\\"Shopper\\\"\\n            },\\n            \\\"credit-card\\\": {\\n               \\\"card-number\\\": \\\"4111111111111111\\\",\\n               \\\"expiration-month\\\": \\\"07\\\",\\n               \\\"expiration-year\\\": \\\"2023\\\"\\n            }\\n         }\\n      ]\\n   }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"JSON\"\n    }\n  ]\n}\n[/block]","updates":[],"order":0,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"612d0fa91ebeef00539fb8a5","createdAt":"2021-08-30T17:04:41.051Z","user":"606df105d9ab93003f73cb10","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Batch Transactions","slug":"batch-transactions","order":8,"from_sync":false,"reference":false,"_id":"613a2bc99ca316007473ee77","createdAt":"2021-09-09T15:44:09.630Z","version":"60fed21a76106200102eaec3","project":"57336fd5a6a9c40e00e13a0b","__v":0},"version":{"version":"8976-JSON","version_clean":"8976.0.0-JSON","codename":"3.39 Release","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["60fed21a76106200102eae0a","60fed21a76106200102eae0b","60fed21a76106200102eae0c","60fed21a76106200102eae0d","60fed21a76106200102eae0e","60fed21a76106200102eae0f","60fed21a76106200102eae10","60fed21a76106200102eae11","60fed21a76106200102eae12","60fed21a76106200102eae13","60fed21a76106200102eae14","60fed21a76106200102eae15","60fed21a76106200102eae16","60fed21a76106200102eae17","60fed21a76106200102eae18","60fed21a76106200102eae19","60fed21a76106200102eae1a","60fed21a76106200102eae1b","60fed21a76106200102eae1c","613a2bc99ca316007473ee77"],"_id":"60fed21a76106200102eaec3","project":"57336fd5a6a9c40e00e13a0b","__v":1,"forked_from":"60a40b18fa93ca00237af576","createdAt":"2018-04-24T15:22:41.561Z","releaseDate":"2018-04-24T15:22:41.561Z"},"project":"57336fd5a6a9c40e00e13a0b","__v":0,"parentDoc":null}

postCreate Batch Transaction


Definition

{{ api_url }}{{ page_api_url }}

Documentation

The Create Batch Transaction request enables you to process multiple transactions at once, including credit card transactions (Auth Capture only), ACH/ECP, SEPA, and PayPal recurring transactions.

The request includes multiple cardTransaction and/or altTransaction resources; a unique batch ID that you define; and a callback URL pointing to where you would like the status of the batch transaction to be sent after processing.

The API sends an immediate response to the Create Batch Transaction request and then the individual transactions in the request are processed. Once all transactions are processed, BlueSnap sends the full batch result to the callback URL you provided in the request. Some of the transactions may be successfully processed and some may fail. However, as long as the batch file was successfully processed, the callback status of the batch will be completed. For an example of the batch result that is sent to your callback URL after the transactions have been processed, see Example Batch Result.

Transaction limit per batch

There is a limit of 2000 transactions per batch.

Try it in the API Explorer

Request Content

batchTransaction container    required, contains the following properties (see batchTransaction ):
   batchId string    required
   callbackUrl string    required
   cardTransaction container    required for credit card transactions (see card-transaction)
   altTransaction container    required for ACH/ECP, SEPA, or PayPal transactions (see altTransaction)

Response Details

If successful, the response HTTP status code is 201 Created.
Note that if an error occurs, the error format is slightly different from other error types. See Batch transaction errors.
For an example of the batch result that is sent to your callback URL after the transactions have been processed, see Example Batch Result.


Examples

Request Examples

curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "batchId": "PKB0042",
    "callbackUrl": "http://example.com/batch_callback ",
    "cardTransaction": [{
        "cardTransactionType": "AUTH_CAPTURE",
        "merchantTransactionId": "566",
        "amount": 20.00,
        "currency": "USD",
        "cardHolderInfo": {
            "firstName": "Joe",
            "lastName": "Example"
        },
        "creditCard": {
            "cardNumber": "4263982640269299",
            "expirationMonth": "02",
            "expirationYear": "2023"
        }
    },{
        "cardTransactionType": "AUTH_CAPTURE",
        "merchantTransactionId": "567",
        "amount": 25.00,
        "currency": "USD",
        "cardHolderInfo": {
            "firstName": "Jane",
            "lastName": "Shopper"
        },
        "creditCard": {
            "cardNumber": "4111111111111111",
            "expirationMonth": "07",
            "expirationYear": "2023"
        }
    }]
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "batchId": "PKB0043",
    "callbackUrl": "http://example.com/batch_callback ",
    "cardTransaction": [{
        "cardTransactionType": "AUTH_CAPTURE",
        "merchantTransactionId": "566",
        "amount": 11.00,
        "currency": "USD",
        "vaultedShopperId": 19596516
    },{
        "cardTransactionType": "AUTH_CAPTURE",
        "merchantTransactionId": "567",
        "amount": 12.00,
        "currency": "USD",
        "vaultedShopperId": 19596754,
        "creditCard": {
            "cardLastFourDigits": "9299"
        }
    }]
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "batchId": "PKB0044",
    "callbackUrl": "http://example.com/batch_callback ",
    "altTransaction": [{
        "amount": 100.00,
        "currency": "USD",
        "paypalTransaction": {
            "paypalSubscriptionId": 22758655
        }
    }]
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "batchId": "PKB0045",
    "callbackUrl": "http://example.com/batch_callback ",
    "cardTransaction": [{
        "cardTransactionType": "AUTH_CAPTURE",
        "merchantTransactionId": "566",
        "amount": 20.00,
        "currency": "USD",
        "cardHolderInfo": {
            "firstName": "Joe",
            "lastName": "Example"
        },
        "creditCard": {
            "encryptedCardNumber": "$bsjs_1_0_4$BFxgRNbmuILoOGnT+GRqSKUw51ZEwJbaMNVZhSg1vxqaQlk4W3SbO0VE/yMiSUSwff9r08FDm//mY6RUv7i/IpmkgIfQJUhw09vohKzZF0OwPdD4xKX3DP+ZNwDWkI5655hQuAZJz3n/VFo22v4zJu4ZliFujDT9tjq/UjzlNgwMkIgGUa/0Zh6HG2MJWjGU8X0RZI/3aCTq7T/r3qeDWLOko10bHLQ1/YdLIw9LsWAOQfHMvMRB+fx+adFuvAGQfl3KFU9S43ME0IG32O9XhjWdJ8yv6bMa9MScpbeYuWH4lfIZNu3Je+H9coNZtMoY3zHZIAcHhjGcsWpTfTltew==$B3TT62QoCueWA4HoqrSwe+flRtEipADuQMy0XGfdaWHMy8ay6fa8sp8wA7rzxDJv$FYRb0yVz2fTvWemafDpeV1UPxezJkTQTYvdaGlJ5nJU=",
            "cardType": "VISA",
            "expirationMonth": "02",
            "expirationYear": "2023"
        }
    }]
}'
curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "batchId": "PKB0061",
    "callbackUrl": "http://example.com/batch_callback ",
    "cardTransaction": [
        {
            "cardTransactionType": "AUTH_CAPTURE",
            "merchantTransactionId": "566",
            "softDescriptor": "DescTest txn1",
            "amount": 11.00,
            "currency": "USD",
            "cardHolderInfo": {
                "firstName": "John",
                "lastName": "Doe"
            },
            "creditCard": {
                "cardNumber": "4263982640269299",
                "expirationMonth": "02",
                "expirationYear": "2023"
            }
        }
    ],
    "altTransaction": [
        {
            "softDescriptor": "ABC COMPANY",
            "amount": 100.00,
            "currency": "USD",
            "payerInfo": {
                "firstName": "John",
                "lastName": "Doe",
                "zip" : "12345",
                "phone": "1234567890"
            },
            "ecpTransaction": {
                "accountNumber": "4099999992",
                "routingNumber": "011075150",
                "accountType": "CONSUMER_CHECKING"
            },
            "authorizedByShopper": "true"
        },
        {
            "softDescriptor": "SepaPapi",
            "amount": 20.00,
            "currency": "EUR",
            "payerInfo": {
                "firstName": "John",
                "lastName": "Doe",
                "phone": "23123133213",
                "zip" : "45353434",
                "country": "IT",
                "state": "ca",
                "city": "London",
                "address": "green line 21"
            },
            "sepaDirectDebitTransaction": {
                "iban": "DE09100100101234567891",
                "bic": "PBNKDEFFXXX"
            },
            "authorizedByShopper": "true"
        }
    ]
}
curl -v -X POST https://sandbox.bluesnap.com/services/2/batch-transactions \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \
-d '
{
    "batchId": "PKB0035",
    "callbackUrl": "http://example.com/batch_callback ",
    "cardTransaction": [{
        "cardTransactionType": "CAPTURE",
        "transactionId": "38591014",
        "merchantTransactionId": "1"
    }]
}

Response Example

Back to Top


Example Descriptions

For details about the above examples, see:

Basic Create Batch Transaction

This example shows a basic Create Batch Transaction request, containing two cardTransaction resources with the required fields to process a credit card payment.

Note that within each cardTransaction resource you can use any of the options available for a single Auth Capture or Create PayPal Transaction (recurring subscription payment only) request, such as using a vaulted shopper, sending encrypted card information, including metadata, and so on.

Create Batch Transaction with vaulted shoppers

To perform a Create Batch Transaction request with existing vaulted shoppers, you'll need to include the vaultedShopperId property within the cardTransaction or altTransaction resources in your request.

Remember to include the card's last four digits if multiple cards are saved for the shopper.

Above is an example of a request with a vaulted shopper ID within each cardTransaction resource.

Create Batch Transaction with PayPal recurring subscription payment

To perform batch transactions with PayPal payments for subscriptions, you will need to send the altTransaction resource in your request, and include in it the paypalTransaction resource, with the paypalSubscriptionId element.

The request should contain only one transaction per unique paypalSubscriptionId.

On the right is an example of a request with one PayPal subscription transaction.

For more information, see Merchant-managed PayPal subscriptions.

Create Batch Transaction with encrypted card details

Your PCI compliance requirements and API permission level may require that you send credit card data in encrypted format only. To do this, you'll need to include the encryptedCardNumber and encryptedSecurityCode properties within the cardTransaction resources in your request.

On the right is an example of a request with encrypted credit card numbers within each cardTransaction resource.



Back to Top


API Explorer

To test out a call, enter the JSON portion of the request below and then click Try it!
In order to get a successful response, you must enter a unique batch ID in the batchId property.

Tip: Copy the JSON portion from one of the example requests above, or use the JSON code below as a starting point. You can enter different parameters and test credit card numbers to see how your test scenario would work. The request headers, including authorization, are already built in for you in this test area, so you should not include them here.

{
   "batch-transaction": {
      "batch-id": "567890",
      "callback-url": "http://example.com/batch_callback",
      "card-transaction": [
         {
            "card-transaction-type": "AUTH_CAPTURE",
            "merchant-transaction-id": "566",
            "amount": "20.00",
            "currency": "USD",
            "card-holder-info": {
               "first-name": "Joe",
               "last-name": "Example"
            },
            "credit-card": {
               "card-number": "4263982640269299",
               "expiration-month": "02",
               "expiration-year": "2023"
            }
         },
         {
            "card-transaction-type": "AUTH_CAPTURE",
            "merchant-transaction-id": "567",
            "amount": "25.00",
            "currency": "USD",
            "card-holder-info": {
               "first-name": "Jane",
               "last-name": "Shopper"
            },
            "credit-card": {
               "card-number": "4111111111111111",
               "expiration-month": "07",
               "expiration-year": "2023"
            }
         }
      ]
   }
}

User Information

Try It Out


post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}