# Installments Plan API source: https://developer.mastercard.com/unified-installments/documentation/testing/mastercard-installments-payment-services/installments-plan-api/index.md Using a successful offer data returned by `POST /offers` API, `POST /plans` will always return a successful response. The test data in this section provides various scenarios for implementing the API. ## Test cases for GET /plans/{plan_id} {#test-cases-for-get-plansplan_id} ### Test Case 1: Success-GET Initiated Plan {#test-case-1-success-get-initiated-plan} **GIVEN** : The client has access to the Mastercard Installment API and has integrated their solution or application with the [/plans](https://developer.mastercard.com/unified-installments/documentation/api-reference/mastercard-installments-services/inbound-api/index.md#apis) endpoint. **WHEN** : The client backend system makes a REST call to the '/plans/{planId}' endpoint. **THEN** : The plan is found and returned based on the plan ID. The response body consumer object will be decrypted using the suggested MC Encryption LIB. ##### Request Parameters {#request-parameters} da30272e-3937-4c74-b849-63c8a5464556 ##### Response {#response} * JSON ```JSON { "planId": "da30272e-3937-4c74-b849-63c8a5464556", "offerId": "21345725", "providerId": "29694e7a-b4a8-11ec-b909-0242ac120002", "status": "CREATED", "merchant": { "name": "Decor shop", "acceptor": "409749", "mcc": "1711", "country": "USA" }, "transaction": { "amount": 200, "currency": "USD" }, "planInstallmentInformation": { "apr": 9, "totalAmount": 6000, "currency": "USD", "installmentAmount": 9.14, "installmentFee": 0, "tenure": 24, "frequency": "MONTHLY" }, "scheduledRepayments": [ { "installmentNumber": 1, "amount": 9.14, "dueDate": "2022-10-20" }, { "installmentNumber": 2, "amount": 9.14, "dueDate": "2022-11-20" }, { "installmentNumber": 3, "amount": 9.14, "dueDate": "2022-12-20" }, { "installmentNumber": 4, "amount": 9.14, "dueDate": "2023-01-20" }, { "installmentNumber": 5, "amount": 9.14, "dueDate": "2023-02-20" }, { "installmentNumber": 6, "amount": 9.14, "dueDate": "2023-03-20" }, { "installmentNumber": 7, "amount": 9.14, "dueDate": "2023-04-20" }, { "installmentNumber": 8, "amount": 9.14, "dueDate": "2023-05-20" }, { "installmentNumber": 9, "amount": 9.14, "dueDate": "2023-06-20" }, { "installmentNumber": 10, "amount": 9.14, "dueDate": "2023-07-20" }, { "installmentNumber": 11, "amount": 9.14, "dueDate": "2023-08-20" }, { "installmentNumber": 12, "amount": 9.14, "dueDate": "2023-09-20" }, { "installmentNumber": 13, "amount": 9.14, "dueDate": "2023-10-20" }, { "installmentNumber": 14, "amount": 9.14, "dueDate": "2023-11-20" }, { "installmentNumber": 15, "amount": 9.14, "dueDate": "2023-12-20" }, { "installmentNumber": 16, "amount": 9.14, "dueDate": "2024-01-20" }, { "installmentNumber": 17, "amount": 9.14, "dueDate": "2024-02-20" }, { "installmentNumber": 18, "amount": 9.14, "dueDate": "2024-03-20" }, { "installmentNumber": 19, "amount": 9.14, "dueDate": "2024-04-20" }, { "installmentNumber": 20, "amount": 9.14, "dueDate": "2024-05-20" }, { "installmentNumber": 21, "amount": 9.14, "dueDate": "2024-06-20" }, { "installmentNumber": 22, "amount": 9.14, "dueDate": "2024-07-20" }, { "installmentNumber": 23, "amount": 9.14, "dueDate": "2024-08-20" }, { "installmentNumber": 24, "amount": 9.14, "dueDate": "2024-09-20" } ], "consumer": { "email": "john.doe@test.com", "mobile": "6360101010", "isdCode": "1" } } ``` #### Test Case 2: Success-GET Approved Plan {#test-case-2-success-get-approved-plan} **GIVEN** : The client has access to the Mastercard Installment API and has integrated their solution/application with the [/plans](https://developer.mastercard.com/unified-installments/documentation/api-reference/mastercard-installments-services/inbound-api/index.md#apis) endpoint. **WHEN** : The client backend system makes a REST call to the '/plans/{planId}' endpoint. **THEN** : The plan is found and returned based on the plan ID. The response body consumer object will be decrypted using the suggested MC Encryption LIB. ##### Request Parameters {#request-parameters-1} 16fa4f03-15cb-46da-bb96-1e3f672688fe ##### Response {#response-1} * JSON ```JSON { "planId": "16fa4f03-15cb-46da-bb96-1e3f672688fe", "offerId": "21345735", "providerId": "29694e7a-b4a8-11ec-b909-0242ac120002", "status": "APPROVED", "merchant": { "name": "Decor shop", "mcc": "1711", "country": "USA" }, "transaction": { "amount": 3000, "currency": "USD" }, "planInstallmentInformation": { "apr": 11.02, "totalAmount": 100, "currency": "USD", "installmentAmount": 1018.43, "installmentFee": 0, "tenure": 3, "frequency": "MONTHLY" }, "scheduledRepayments": [ { "installmentNumber": 1, "amount": 1018.43, "dueDate": "2022-10-20" }, { "installmentNumber": 2, "amount": 1018.43, "dueDate": "2022-11-20" }, { "installmentNumber": 3, "amount": 1018.43, "dueDate": "2022-12-20" } ], "consumer": { "email": "john.doe@test.com", "mobile": "6360101010", "isdCode": "1" } } ``` #### Test Case 3: Success-GET Rejected Plan {#test-case-3-success-get-rejected-plan} **GIVEN** : The client has access to the Mastercard Installment API and has integrated their solution/application with the [/plans](https://developer.mastercard.com/unified-installments/documentation/api-reference/mastercard-installments-services/inbound-api/index.md#apis) endpoint. **WHEN** : The client backend system makes a REST call to the '/plans/{planId}' endpoint. **THEN** : The plan is found and returned based on the plan ID. The response body consumer object will be decrypted using the suggested MC Encryption LIB. ##### Request Parameters {#request-parameters-2} 9eb01b62-e832-43bd-8ea8-7eca0e82bd49 ##### Response {#response-2} * JSON ```JSON { "rejectReasonCode": "OTHER_REASON", "rejectReasonDetail": "Credit score is too low", "planId": "9eb01b62-e832-43bd-8ea8-7eca0e82bd49", "offerId": "21345723", "providerId": "29694e7a-b4a8-11ec-b909-0242ac120002", "status": "DECLINED", "merchant": { "name": "Decor shop", "acceptor": "409749", "mcc": "1711", "country": "USA" }, "transaction": { "amount": 200, "currency": "USD" }, "planInstallmentInformation": { "apr": 9.01, "totalAmount": 100, "currency": "USD", "installmentAmount": 17.49, "installmentFee": 0, "tenure": 12, "frequency": "MONTHLY" }, "scheduledRepayments": [ { "installmentNumber": 1, "amount": 17.49, "dueDate": "2022-10-20" }, { "installmentNumber": 2, "amount": 17.49, "dueDate": "2022-11-20" }, { "installmentNumber": 3, "amount": 17.49, "dueDate": "2022-12-20" }, { "installmentNumber": 4, "amount": 17.49, "dueDate": "2023-01-20" }, { "installmentNumber": 5, "amount": 17.49, "dueDate": "2023-02-20" }, { "installmentNumber": 6, "amount": 17.49, "dueDate": "2023-03-20" }, { "installmentNumber": 7, "amount": 17.49, "dueDate": "2023-04-20" }, { "installmentNumber": 8, "amount": 17.49, "dueDate": "2023-05-20" }, { "installmentNumber": 9, "amount": 17.49, "dueDate": "2023-06-20" }, { "installmentNumber": 10, "amount": 17.49, "dueDate": "2023-07-20" }, { "installmentNumber": 11, "amount": 17.49, "dueDate": "2023-08-20" }, { "installmentNumber": 12, "amount": 17.49, "dueDate": "2023-09-20" } ], "consumer": { "email": "john.doe@test.com", "mobile": "6360101010", "isdCode": "1" } } ``` ## Test cases for POST /plans {#test-cases-for-post-plans} ## Positive test scenarios {#positive-test-scenarios} ### Test Case 1: Success-Verify that the consumer is able to create a plan by providing the required parameters {#test-case-1-success-verify-that-the-consumer-is-able-to-create-a-plan-by-providing-the-required-parameters} **Given** : The consumer has access to the Mastercard Installment API and has integrated their solution or application with the [/installments/plans](https://developer.mastercard.com/unified-installments/documentation/api-reference/mastercard-installments-services/inbound-api/index.md#apis) endpoint. **When** : The consumer backend system makes a REST call to the '/installments/plans' endpoint. **Then** : The consumer should be able to create a plan based on `offerId`, total amount, and offer details. ##### Request Payload {#request-payload} * JSON ```JSON { "offerId": "98427054", "offerTransactionId": "480285894528466944", "providerId": "29694e7a-b4a8-11ec-b909-0242ac120002", "tokenTransactionId": "tokenTransactionId", "merchant": { "acceptor": null, "mcc": "1711", "country": "MEX", "acquirerId": "5551", "name": "Testing Merchant", "merchantId": "21605304228" }, "transaction": { "amount": 169.14, "currency": "USD", "stan": "9991", "rrn": "8888", "authorizationCode": "AUTH99", "localDateTime": "2030-03-18T00:00:00Z", "transmissionDateTime": "2030-03-18T00:00:00Z", "transactionLinkId": "" }, "planInstallmentInformation": { "apr": 17.8, "totalAmount": 526.32, "firstInstallmentAmount": 87.72, "otherInstallmentAmount": 87.72, "currency": "USD", "tenure": 6, "frequency": "MONTHLY" }, "schedulePayments": [ { "installmentNumber": 1, "installmentAmount": 28.19, "dueDate": "2030-04-18" }, { "installmentNumber": 2, "installmentAmount": 28.19, "dueDate": "2030-05-18" }, { "installmentNumber": 3, "installmentAmount": 28.19, "dueDate": "2030-06-18" }, { "installmentNumber": 4, "installmentAmount": 28.19, "dueDate": "2030-07-18" }, { "installmentNumber": 5, "installmentAmount": 28.19, "dueDate": "2030-08-18" }, { "installmentNumber": 6, "installmentAmount": 28.19, "dueDate": "2030-09-18" } ], "sensitiveData": { "consumer": { "primaryAccountNumber": "2303770004152813" } } } ``` ##### Response {#response-3} * JSON ```JSON { "planId": "3d56f5a7-db48-41f0-875e-30920e8465f3", "partnerInstallmentLink": "https://example.com/partner/installment-link", "status": "CREATED" } ``` ### Test-case 2: Success-Verify that the consumer is able to create a plan by providing the required parameters and having a token PAN {#test-case-2-success-verify-that-the-consumer-is-able-to-create-a-plan-by-providing-the-required-parameters-and-having-a-token-pan} **Given** : The consumer has access to the Mastercard Installment API and has integrated their solution/application with the [/installments/plans](https://developer.mastercard.com/unified-installments/documentation/api-reference/mastercard-installments-services/inbound-api/index.md#apis) endpoint. **WHEN** : The consumer backend system makes a REST call to the '/installments/plans' endpoint. **THEN** : The consumer should be able to create a plan based on the token PAN provided along with offerId, total amount, and offer details. ##### Request Payload {#request-payload-1} * JSON ```JSON { "offerId": "98427054", "offerTransactionId": "480285894528466944", "providerId": "29694e7a-b4a8-11ec-b909-0242ac120002", "tokenTransactionId": "tokenTransactionId", "merchant": { "acceptor": null, "mcc": "1711", "country": "MEX", "acquirerId": "5551", "name": "Testing Merchant", "merchantId": "21605304228" }, "transaction": { "amount": 169.14, "currency": "USD", "stan": "9991", "rrn": "8888", "authorizationCode": "AUTH99", "localDateTime": "2030-03-18T00:00:00Z", "transmissionDateTime": "2030-03-18T00:00:00Z", "transactionLinkId": "" }, "planInstallmentInformation": { "apr": 17.8, "totalAmount": 526.32, "firstInstallmentAmount": 87.72, "otherInstallmentAmount": 87.72, "currency": "USD", "tenure": 6, "frequency": "MONTHLY" }, "schedulePayments": [ { "installmentNumber": 1, "installmentAmount": 28.19, "dueDate": "2030-04-18" }, { "installmentNumber": 2, "installmentAmount": 28.19, "dueDate": "2030-05-18" }, { "installmentNumber": 3, "installmentAmount": 28.19, "dueDate": "2030-06-18" }, { "installmentNumber": 4, "installmentAmount": 28.19, "dueDate": "2030-07-18" }, { "installmentNumber": 5, "installmentAmount": 28.19, "dueDate": "2030-08-18" }, { "installmentNumber": 6, "installmentAmount": 28.19, "dueDate": "2030-09-18" } ], "sensitiveData": { "consumer": { "primaryAccountNumber": "5468600800011000" } } } ``` ##### Response {#response-4} * JSON ```JSON { "planId": "3d56f5a7-db48-41f0-875e-30920e8465f3", "partnerInstallmentLink": "https://example.com/partner/installment-link", "status": "CREATED" } ``` ## Negative test scenario {#negative-test-scenario} ### Test-case 1: Failure-Verify that the consumer is not able to create a plan when the amount passed in the payload does not match with the actual offer calculation {#test-case-1-failure-verify-that-the-consumer-is-not-able-to-create-a-plan-when-the-amount-passed-in-the-payload-does-not-match-with-the-actual-offer-calculation} **Given** : The consumer has access to the Mastercard Installment API and has integrated their solution/application with the [/installments/plans](https://developer.mastercard.com/unified-installments/documentation/api-reference/mastercard-installments-services/inbound-api/index.md#apis) endpoint. **When** : The consumer backend system makes a REST call to the '/installments/plans' endpoint and provided `totalAmount` does not match as per the offerId passed in the request payload. **Then** : The consumer should not be able to create a plan and return an appropriate error. ##### Request Payload {#request-payload-2} * JSON ```JSON { "offerId": "98427054", "offerTransactionId": "480285894528466944", "providerId": "29694e7a-b4a8-11ec-b909-0242ac120002", "tokenTransactionId": "tokenTransactionId", "merchant": { "acceptor": null, "mcc": "1711", "country": "MEX", "acquirerId": "5551", "name": "Testing Merchant", "merchantId": "21605304228" }, "transaction": { "amount": 179.14, "currency": "USD", "stan": "9991", "rrn": "8888", "authorizationCode": "AUTH99", "localDateTime": "2030-03-18T00:00:00Z", "transmissionDateTime": "2030-03-18T00:00:00Z", "transactionLinkId": "" }, "planInstallmentInformation": { "apr": 17.8, "totalAmount": 526.32, "firstInstallmentAmount": 87.72, "otherInstallmentAmount": 87.72, "currency": "USD", "tenure": 6, "frequency": "MONTHLY" }, "schedulePayments": [ { "installmentNumber": 1, "installmentAmount": 28.19, "dueDate": "2030-04-18" }, { "installmentNumber": 2, "installmentAmount": 28.19, "dueDate": "2030-05-18" }, { "installmentNumber": 3, "installmentAmount": 28.19, "dueDate": "2030-06-18" }, { "installmentNumber": 4, "installmentAmount": 28.19, "dueDate": "2030-07-18" }, { "installmentNumber": 5, "installmentAmount": 28.19, "dueDate": "2030-08-18" }, { "installmentNumber": 6, "installmentAmount": 28.19, "dueDate": "2030-09-18" } ], "sensitiveData": { "consumer": { "primaryAccountNumber": "2303770004152813" } } } ``` ##### Response {#response-5} * JSON ```JSON { "Errors": { "Error": [ { "ReasonCode": "invalid.request.parameter", "Source": "mci-installment-bnpl-plans-api", "Description": "Retrieved Total Amount validation failed-Offer value must match with Plan Value.", "Recoverable": false, "Details": "Offer validation failed" } ] } } ``` ### Test-case 2: Failure-PAN Mismatch {#test-case-2-failure-pan-mismatch} ##### Request Body {#request-body} * JSON ```JSON { "offerId": "71392364", "planInstallmentInformation": { "totalAmount": 160, "currency": "USD", "tenure": 12, "frequency": "MONTHLY", "otherInstallmentAmount": 13.33 }, "sensitiveData": { "consumer": { "primaryAccountNumber": 2303770000078038 } }, "offerTransactionId": "633226000502624256" } ``` ##### Response {#response-6} * JSON ```JSON { "Errors": { "Error": [ { "ReasonCode": "invalid.request.parameter", "Source": "installments-bnpl-plans", "Description": "PAN match validation failed - Offer value must match with Plan Value", "Recoverable": false, "Details": "Offer validation failed" } ] } } ```