Cards & Wallets · PaySuite payment page

Saved payment methods

Avoid asking customers to re-enter their card details by storing payment methods against a customer, so they can choose one of them the next time you initialise a hosted session.

Everything described in saving cards for reuse applies here — the cardholder agreement you must display, the stored credentials framework, and how a saved card can be re-used afterwards.

Save the card used for a payment

To save the card a transaction uses, identify the customer in the session initialisation request. The example below is the minimal request for saving a card while taking a payment.

Payment session saving the card for a customer
EndpointDefinition
POST /hosted/rest/sessions/{instId}/payments
Request body
{
  "session": {
    "returnUrl": {
      "url": "https://www.example.com/return"
    }
  },
  "transaction": {
    "money": {
      "currency": "GBP",
      "amount": {
        "fixed": 25.00
      }
    },
    "merchantReference": "aReference"
  },
  "customer": {
    "identity": {
      "merchantCustomerId": "aNewCustomerReference"
    },
    "details": {
      "name": "Test Customer"
    }
  }
}
cURL
curl -X POST "{targetEnvironmentPath}/hosted/rest/sessions/{instId}/payments" \
  -u "{apiUser}:{apiPassword}" \
  -H "Content-Type: application/json" \
  -d '{
  "session": {
    "returnUrl": {
      "url": "https://www.example.com/return"
    }
  },
  "transaction": {
    "money": {
      "currency": "GBP",
      "amount": {
        "fixed": 25.00
      }
    },
    "merchantReference": "aReference"
  },
  "customer": {
    "identity": {
      "merchantCustomerId": "aNewCustomerReference"
    },
    "details": {
      "name": "Test Customer"
    }
  }
}'
Response
HTTP/1.1 201 Created

{
  "sessionId": "SMjptwtSrWydAA6osVMdJqodk",
  "redirectUrl": "https://secure.mite.pay360.com/hosted/SMjptwtSrWydAA6osVMdJqodk/begin/SMjptwtSrWydAA6osVMdJqodk",
  "status": "SUCCESS"
}

When a later request uses the identifier of an existing customer and populates customer.details, the details stored for that customer are updated with those in the request.

A customer can have multiple registered cards. On the payment page they can choose one of the cards already saved for them, or pay with another card.

Manage a customer's cards

To let a customer manage their saved cards without taking a payment, initialise a card management session and send them to the returned redirectUrl.

Create a card management session
EndpointDefinition
POST /hosted/rest/sessions/{instId}/cards
Request body
{
  "session": {
    "returnUrl": {
      "url": "https://www.example.com/return"
    }
  },
  "customer": {
    "identity": {
      "merchantCustomerId": "aSavedCustomerReference"
    }
  }
}
cURL
curl -X POST "{targetEnvironmentPath}/hosted/rest/sessions/{instId}/cards" \
  -u "{apiUser}:{apiPassword}" \
  -H "Content-Type: application/json" \
  -d '{
  "session": {
    "returnUrl": {
      "url": "https://www.example.com/return"
    }
  },
  "customer": {
    "identity": {
      "merchantCustomerId": "aSavedCustomerReference"
    }
  }
}'
Response
HTTP/1.1 201 Created

{
  "sessionId": "SMjqppSjFEW1GErV03liu4qbB",
  "redirectUrl": "https://secure.mite.pay360.com/hosted/SMjqppSjFEW1GErV03liu4qbB/begin/SMjqppSjFEW1GErV03liu4qbB",
  "status": "SUCCESS"
}

Work with saved cards from your own system

To list, retrieve, update and remove the payment methods saved against a customer, see Manage Customers.