Please see Merchant Direct Debit (MDD) instead.
Charges a specific AccountID
using direct debit. A previously approved direct debit mandate must exist on the AccountID
(see SelectAccount for details).
{
"method":"Charge",
"params":{
"Signature":"f4ThjuMqbsdG6u ... S16VbzD4h==",
"UUID":"258a2184-2842-b485-25ca-293525152425",
"Data":{
"AccountID":"1234567890",
"Amount":"25.00",
"Attributes":{
"Email":"test@trustly.com",
"ShopperStatement":"Trustly"
},
"Currency":"SEK",
"EndUserID":12345,
"MessageID":"your_unique_deposit_id",
"NotificationURL":"https://URL_to_your_notification_service",
"Password":"merchant_password",
"Username":"merchant_username"
}
},
"version":"1.1"
}
{
"method": "Charge",
"params": {
"Signature": "f4ThjuMqbsdG6u ... S16VbzD4h==",
"UUID": "258a2184-2842-b485-25ca-293525152425",
"Data": {
"AccountID": "1234567890",
"Amount": "25.00",
"Attributes": {
"PSPMerchant": "merchant_name",
"PSPMerchantURL": "https://merchantURL.com/",
"MerchantCategoryCode": "1234",
"Email": "test@trustly.com",
"ShopperStatement": "Trustly"
},
"Currency": "SEK",
"EndUserID": 12345,
"MessageID": "your_unique_transaction_id",
"NotificationURL": "https://URL_to_your_notification_service",
"Password": "merchant_password",
"Username": "merchant_username"
}
},
"version": "1.1"
}
The returned result is a hash with the following attributes.
{
"method":"Charge",
"uuid":"258a2184-2842-b485-25ca-293525152425",
"data":{
"result":"1",
"rejected":null,
"orderid":"1234512345"
},
"signature":"QBuLx ... JDGM/GVq5EBaPnGmvxA=="
}
The notifications delivered for Charge orders are as follows:
Immediately after the Charge has been accepted for processing, a Pending notification is sent.
If the Charge could not be processed, a Cancel notification is sent.
Once the Charge has been successfully processed, a Credit notification is sent.
These error codes can be returned for Charge calls. To handle errors, see Error handling.
The Charge method can also return a number of "rejected" messages. See rejected
in Response attributes.
Error Number | Error Code | Description |
---|---|---|
602 | ERROR_FUNCTION_ACCESS_DENIED | The merchant does not have access to this function. |
607 | ERROR_HOST_ACCESS_DENIED | The IP address of the merchant has not been added to Trustly’s IP-whitelist. |
615 | ERROR_INVALID_AMOUNT | The Amount is invalid. The amount must be > 0 with 2 decimals. |
616 | ERROR_INVALID_CREDENTIALS | The username and/or password used in the API call is incorrect. |
620 | ERROR_UNKNOWN | There could be several reasons for this error, please reach out to your Trustly contact for details. |
623 | ERROR_INVALID_PARAMETERS | Some value or parameter in the API call does not match the expected format. |
636 | ERROR_UNABLE_TO_VERIFY_RSA_SIGNATURE | The signature could not be verified using the merchant’s public key. Either the wrong private key was used to generate the signature, or the the data object used to create the signature was serialised incorrectly. |
637 | ERROR_DUPLICATE_MESSAGE_ID | The MessageID has been used before. |
638 | ERROR_ENDUSER_IS_BLOCKED | The end-user that initiated the payment is blocked. |
639 | ERROR_NO_PUBLIC_KEY | No public key has been configured for the merchant on Trustly’s side. |
642 | ERROR_INVALID_EMAIL | The email attribute is missing or invalid (this is a requirement when using Trustly Direct Debit). |
688 | ERROR_DUPLICATE_UUID | This UUID has been used before. |
696 | ERROR_ENDUSERID_IS_NULL | The EndUserID sent in the request is null |
697 | ERROR_MESSAGEID_IS_NULL | The MessageID sent in the request is null |
704 | ERROR_MALFORMED_MESSAGEID | The MessageID sent in the request is malformed. |
705 | ERROR_MALFORMED_NOTIFICATIONURL | The NotificationURL sent in the request is malformed. It must be a valid https address. |
706 | ERROR_MALFORMED_ENDUSERID | The EndUserID sent in the request is malformed. |
712 | ERROR_DIRECT_DEBIT_NOT_ALLOWED | Trustly Direct Debit (TDD) is not enabled on the merchant’s user in Trusty’s system. If you want to use TDD, please reach out to your Trustly contact. |
717 | ERROR_INVALID_ORDER_ATTRIBUTE | One or more attributes are sent with the incorrect value. Please reach out to your Trustly contact for more information. |
718 | ERROR_DISABLED_USER | The merchant’s user is disabled in Trustly’s system. |
734 | ERROR_NOT_SECURE_NOTIFICATIONURL | The NotificationURL must be using HTTPS, not plain HTTP. |
These error codes can be returned for Charge calls. To handle errors, see Error handling.
The Charge method can also return a number of "rejected" messages. See rejected
in Response attributes.
Error Number | Error Code | Description |
---|---|---|
602 | ERROR_FUNCTION_ACCESS_DENIED | The merchant does not have access to this function. |
607 | ERROR_HOST_ACCESS_DENIED | The IP address of the merchant has not been added to Trustly’s IP-whitelist. |
615 | ERROR_INVALID_AMOUNT | The Amount is invalid. The amount must be > 0 with 2 decimals. |
616 | ERROR_INVALID_CREDENTIALS | The username and/or password used in the API call is incorrect. |
620 | ERROR_UNKNOWN | There could be several reasons for this error, please reach out to your Trustly contact for details. |
623 | ERROR_INVALID_PARAMETERS | Some value or parameter in the API call does not match the expected format. |
636 | ERROR_UNABLE_TO_VERIFY_RSA_SIGNATURE | The signature could not be verified using the merchant’s public key. Either the wrong private key was used to generate the signature, or the the data object used to create the signature was serialised incorrectly. |
637 | ERROR_DUPLICATE_MESSAGE_ID | The MessageID has been used before. |
638 | ERROR_ENDUSER_IS_BLOCKED | The end-user that initiated the payment is blocked. |
639 | ERROR_NO_PUBLIC_KEY | No public key has been configured for the merchant on Trustly’s side. |
642 | ERROR_INVALID_EMAIL | The email attribute is missing or invalid (this is a requirement when using Trustly Direct Debit). |
688 | ERROR_DUPLICATE_UUID | This UUID has been used before. |
696 | ERROR_ENDUSERID_IS_NULL | The EndUserID sent in the request is null |
697 | ERROR_MESSAGEID_IS_NULL | The MessageID sent in the request is null |
704 | ERROR_MALFORMED_MESSAGEID | The MessageID sent in the request is malformed. |
705 | ERROR_MALFORMED_NOTIFICATIONURL | The NotificationURL sent in the request is malformed. It must be a valid https address. |
706 | ERROR_MALFORMED_ENDUSERID | The EndUserID sent in the request is malformed. |
712 | ERROR_DIRECT_DEBIT_NOT_ALLOWED | Trustly Direct Debit (TDD) is not enabled on the merchant’s user in Trusty’s system. If you want to use TDD, please reach out to your Trustly contact. |
717 | ERROR_INVALID_ORDER_ATTRIBUTE | One or more attributes are sent with the incorrect value. Please reach out to your Trustly contact for more information. |
718 | ERROR_DISABLED_USER | The merchant’s user is disabled in Trustly’s system. |
734 | ERROR_NOT_SECURE_NOTIFICATIONURL | The NotificationURL must be using HTTPS, not plain HTTP. |