Capture scenarios for Paypal

Capture Scenarios Response Status Description Notification Status Description
The transaction has been fully captured.

Only payments with “Authorized” status (9) can be captured.
Final Status: 2 Success Final Notification Status: 2 Success
The payment has been partially captured.

Only payments with “Authorized” status can be partially captured. The payment has been sent out to be partially captured, but the payment gateway has not yet confirmed that the payment is successful.
Final Status: 35 Partially Captured Final Notification Status: 35 Partially Captured
Capture Failed Scenarios Return Code Description
The transaction could not be captured.

The transaction is not in an Authorized status (it has already been fully Captured or Partially Captured).
Return Code: 17 Payment is invalid

For a complete list of all the possible Return Code IDs go to our section GlobalPay Return Codes.

See the request – response examples for the above possible scenarios:

  • Success Status

    A payment can only be captured if it has an Authorized status. Once the payment has an Authorized status (9), you can capture either the full amount or a partial amount of the initial authorized amount for the transaction.

    A 200 HTTP response (OK) is returned if the request was completed successfully.

    Full capture means you capture the entire authorized amount for the initial transaction.

    Request:

    POST https://paytest.smart2pay.com/v1/payments/4813936/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=utf-8
    
    {
        "Payment": {
            "ID": 4813936,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20191121152453",
            "MerchantTransactionID": "s2ptest_p1",
            "OriginatorTransactionID": null,
            "Amount": 100,
            "Currency": "EUR",
            "CapturedAmount": "100",
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": null,
            "MethodID": 94,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30201,
            "NotificationDateTime": "20191121152731",
            "Customer": null,
            "BillingAddress": {
                "ID": 452,
                "City": null,
                "ZipCode": null,
                "State": null,
                "Street": null,
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "ES"
            },
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 2,
                "Info": "Success",
                "Reasons": null
            },
            "Fraud": null,
            "MethodTransactionID": null,
            "TokenLifetime": 10,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=917D36F62AAA2BE344A324E612A0B5CC.4813936"
        }
    }

    We will notify you about the new status of the payment to the Notification URL you setup in the Merchant Dashboard. The format of the received notification has the same structure as the response of the initial request.

    You need to respond with HTTP code 204 (No Content)!

    Payment notification format:

    Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=
    
    {
        "Payment": {
            "ID": 4813936,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20191121152453",
            "MerchantTransactionID": "s2ptest_p1",
            "OriginatorTransactionID": null,
            "Amount": 100,
            "Currency": "EUR",
            "CapturedAmount": "100",
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": null,
            "MethodID": 94,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30201,
            "NotificationDateTime": "20191121152731",
            "Customer": null,
            "BillingAddress": {
                "ID": 452,
                "City": null,
                "ZipCode": null,
                "State": null,
                "Street": null,
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "ES"
            },
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 2,
                "Info": "Success",
                "Reasons": null
            },
            "Fraud": null,
            "MethodTransactionID": null,
            "TokenLifetime": 10,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=917D36F62AAA2BE344A324E612A0B5CC.4813936"
        }
    }
  • Partially Captured Status

    Partial capture means you have the possibility to capture a smaller amount than the one from the initial authorized transaction. Partial capture is used when you have sent at least part of the order to the consumer and want to capture the amount for the item(s) that have been shipped.

    You can perform only one partial capture for an authorized transaction with the limitation that the amount of the partial capture to be smaller or equal than the initial authorized amount.

    Specify only the captured amount parameter in the query string, in order to partially capture the payment, like in the below example:

    Request:

    POST https://paytest.smart2pay.com/v1/payments/4813937/capture?amount=50
    Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk=

    Response:

    HTTP/1.1 200 OK
    Content-Type: application/json; charset=utf-8
    
    {
        "Payment": {
            "ID": 4813937,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20191121153210",
            "MerchantTransactionID": "s2ptest_p2",
            "OriginatorTransactionID": null,
            "Amount": 100,
            "Currency": "EUR",
            "CapturedAmount": "50",
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": null,
            "MethodID": 94,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30201,
            "NotificationDateTime": "20191121153324",
            "Customer": null,
            "BillingAddress": {
                "ID": 452,
                "City": null,
                "ZipCode": null,
                "State": null,
                "Street": null,
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "ES"
            },
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 35,
                "Info": "PartiallyCaptured",
                "Reasons": null
            },
            "Fraud": null,
            "MethodTransactionID": null,
            "TokenLifetime": 10,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=387EE786392FE554A86CA9E3F3EF1E09.4813937"
        }
    }

    We will notify you about the new status of the payment to the Notification URL you setup in the Merchant Dashboard. The format of the received notification has the same structure as the response of the initial request.

    You need to respond with HTTP code 204 (No Content)!

    Payment notification format:

    Authorization: Basic MzAyMDE6aEo1Um9iWXg5cjdGZk53Q3ZIWTlMWEhxcXIrRkV6cmM3YUp2UVFrNEdhejFtZzdSeXk={
        "Payment": {
            "ID": 4813937,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20191121153210",
            "MerchantTransactionID": "s2ptest_p2",
            "OriginatorTransactionID": null,
            "Amount": 100,
            "Currency": "EUR",
            "CapturedAmount": "50",
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": null,
            "MethodID": 94,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30201,
            "NotificationDateTime": "20191121153324",
            "Customer": null,
            "BillingAddress": {
                "ID": 452,
                "City": null,
                "ZipCode": null,
                "State": null,
                "Street": null,
                "StreetNumber": null,
                "HouseNumber": null,
                "HouseExtension": null,
                "Country": "ES"
            },
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 35,
                "Info": "PartiallyCaptured",
                "Reasons": null
            },
            "Fraud": null,
            "MethodTransactionID": null,
            "TokenLifetime": 10,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": "https://apitest.smart2pay.com/Home?PaymentToken=387EE786392FE554A86CA9E3F3EF1E09.4813937"
        }
    }
  • Return Code: 17 – Payment is invalid

    The transaction could not be captured. The transaction is not in an Authorized status. You can receive this response when the payment you want to Capture is not Authorized or when the payment has already been Captured.

    Request:

    POST https://paytest.smart2pay.com/v1/payments/4813935/capture
    Authorization: Basic MzAxNTE6V05ydTJ5WnJpR2RtNVVMZWt4dFM4cHprUXNRSmdYYTZBZnlnT3FXZXcvNlRBYzNYK1A=

    Response:

    HTTP/1.1 400 Bad Request
    Content-Type: application/json; charset=utf-8{
        "Payment": {
            "ID": 4813935,
            "SkinID": null,
            "ClientIP": null,
            "Created": "20191121151256",
            "MerchantTransactionID": "s2ptest_paypal2",
            "OriginatorTransactionID": null,
            "Amount": "100",
            "Currency": "EUR",
            "CapturedAmount": null,
            "ReturnURL": "http://demo.smart2pay.com/redirect.php",
            "Description": null,
            "MethodID": 94,
            "MethodOptionID": null,
            "IncludeMethodIDs": null,
            "ExcludeMethodIDs": null,
            "PrioritizeMethodIDs": null,
            "SiteID": 30201,
            "NotificationDateTime": "20191121151441",
            "Customer": null,
            "BillingAddress": null,
            "ShippingAddress": null,
            "Articles": null,
            "Details": null,
            "ReferenceDetails": null,
            "CustomParameters": null,
            "PreapprovalID": null,
            "Status": {
                "ID": 2,
                "Info": "Success",
                "Reasons": [
                    {
                        "Code": "17",
                        "Info": "Payment is invalid - 4813935"
                    }
                ]
            },
            "Fraud": null,
            "MethodTransactionID": null,
            "TokenLifetime": null,
            "Capture": null,
            "PreapprovalDetails": null,
            "RedirectURL": null
        }
    }