Related Documents
Document Properties
Kbid2D8305
Last Modified23-Jun-2020
Added to KB21-Jun-2017
Public AccessEveryone
StatusOnline
Doc TypeReferences
Product
  • ICM 7.9
  • ICM 7.10

REST API - Add payment to basket


Note

Starting with 7.10 our REST API is documented using Redoc accessible at docs.intershop.com.

URI

/baskets/<basket-id>/payments

Http Method

POST

Short Description

Adds a payment method to the basket

Query Parameters

none

Example Requests

/baskets/W1oKDgAbKPwAAAFDeTyXcGaV/payments

HTTP Status Codes

201 Created
400 Bad Request - Possible values for header 'error-key':

  • shopping_cart.payment.paymentdata.error (e.g., wrong giftcard number)
  • shopping_cart.payment.missing_fields.error
  • shopping_cart.payment.invalid_fields.error
  • shopping_cart.payment.name.error (Payment method not found)
  • shopping_cart.payment.dublicate.error
  • shopping_cart.payment.available.error (also thrown if basket contains NO items)

401 Unauthorized
403 Forbidden
404 Not found (Basket) - Possible values for header 'error-key':

  • basket.basket_not_found.error

Description

Adds a payment method to the basket. If the user is logged in a registered payment method can be referenced via ID (for payments that have been created with POST /customers/-/payments)

Cartridge

app_sf_rest

Application

B2C Web Shop, SMB Web Shop

Access Restrictions

Requires authentication with user having assigned the following permissions:

  • Purchase (APP_B2B_PURCHASE, only in B2B applications)

Product Version

7.9

Product To Version

 
Status

final

JSON

Request Data Format

application/json

Request related java object

com.intershop.sellside.rest.common.capi.resource.basket.BasketPaymentResource
com.intershop.sellside.rest.common.capi.resourceobject.basket.PaymentRO

Request Example

Simple payment method without attributes:

{
	"name": "ISH_CASH_ON_DELIVERY",
	"type": "Payment"
}

or

{
	"name": "ISH_ONLINEPAY",
	"type": "Payment"
}

or

{
	"name": "ISH_INVOICE",
	"type": "Payment"
}

etc.

Add complex payment methods with all attributes:

{
  "name":"ISH_GIFT_CARD",
  "type":"Payment",
  "parameters":[
    {
      "key":"giftCardNumber",
      "property":"63531247946"
    },
    {
      "key":"giftCardPIN",
      "property":"5956"
    }
  ]
}

or

{
  "name":"ISH_DEBIT_TRANSFER",
  "type":"Payment",
  "parameters":[
    {
      "key":"BIC",
      "property":"12345678901"
    },
    {
      "key":"IBAN",
      "property":"123456789012345678"
    },
    {
      "key":"holder",
      "property":"Patricia Miller"
    }
  ]
}

or

{ 
    "name":"ISH_CREDITCARD", 
    "parameters": 
    [ 
        { 
            "key":"creditCardExpiryDate", 
            "property": "12/20" 
        }, 
        { 
            "key":"creditCardNumber", 
            "property":"4111111111111111" 
        }, 
        { 
            "key":"creditCardType", 
            "property":"vsa" 
        } 
    ] 
}

Add complex payment methods that have been registered to customer:

{
	"name": "ISH_DEBIT_TRANSFER",
	"type": "Payment",
	"id": "wRIKDgAbhZIAAAFDY4iXcGez"
}

Response Data Format

application/json

Response related java object

n/a

Response Example

{
  "type": "Link",
  "uri": "PrimeTech-PrimeTechSpecials-Site/b2c-web-shop/baskets/BhkKAB175IwAAAFGG9duYWtl/payments/eegKAB17KuoAAAFGMlhuYWvS"
}

XML

XML Request Data Format

text/xml

XML Request Java Objects

com.intershop.sellside.rest.common.capi.resource.basket.BasketPaymentResource
com.intershop.sellside.rest.common.capi.resourceobject.basket.PaymentRO

XML Request Example

Simple payment method without attributes:

<Payment name="ISH_CASH_ON_DELIVERY" type="Payment" />

or

<Payment name="ISH_ONLINEPAY" type="Payment" />

or

<Payment name="ISH_INVOICE" type="Payment" />

etc.

Add complex payment methods with all attributes:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Payment name="ISH_GIFT_CARD" type="Payment"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <parameters>
        <Property name="property">
            <key>giftCardNumber</key>
            <property xsi:type="xs:string">41475602889</property>
        </Property>
        <Property name="property">
            <key>giftCardPIN</key>
            <property xsi:type="xs:string">1273</property>
        </Property>
    </parameters>
</Payment>

or

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Payment name="ISH_DEBIT_TRANSFER" type="Payment"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <parameters>
        <Property name="property">
            <key>IBAN</key>
            <property xsi:type="xs:string">123456789012345678</property>
        </Property>
        <Property name="property">
            <key>BIC</key>
            <property xsi:type="xs:string">12345678</property>
        </Property>
        <Property name="property">
            <key>holder</key>
            <property xsi:type="xs:string">Susi Franke</property>
        </Property>
    </parameters>
</Payment>

or

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Payment name="ISH_CREDITCARD" type="Payment"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <parameters>
        <Property name="property">
            <key>creditCardExpiryDate</key>
            <property xsi:type="xs:string">12/20</property>
        </Property>
        <Property name="property">
            <key>creditCardNumber</key>
            <property xsi:type="xs:string">4111111111111111</property>
        </Property>
        <Property name="property">
            <key>creditCardType</key>
            <property xsi:type="xs:string">vsa</property>
        </Property>
    </parameters>
</Payment>

Add complex payment methods that have been registered to customer:

<Payment name="ISH_DEBIT_TRANSFER" type="Payment">
	<id>wRIKDgAbhZIAAAFDY4iXcGez</id>
</Payment>

XML Response Data Format

text/xml

XML Response Java Objects

n/a

XML Response Example

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Link type="Link">
  <uri>PrimeTech-PrimeTechSpecials-Site/b2c-web-shop/baskets/BhkKAB175IwAAAFGG9duYWtl/payments/4nIKAB174BIAAAFG.xtuYWvV</uri>
</Link>

Disclaimer

The information provided in the Knowledge Base may not be applicable to all systems and situations. Intershop Communications will not be liable to any party for any direct or indirect damages resulting from the use of the Customer Support section of the Intershop Corporate Web site, including, without limitation, any lost profits, business interruption, loss of programs or other data on your information handling system.

Customer Support
Knowledge Base
Product Resources
Support Tickets