Ensure Correct Character Encoding

The Mastercard Payment Gateway accepts only ISO-8859-1 and UTF-8 encoding. You can specify the encoding to use in the content-type header on the HTTPS POST/HTTPS PUT message. If not specified, the Mastercard Payment Gateway defaults the encoding to ISO-8859-1.

Following are examples of the content type headers:

  • For the NVP protocol, use
    "Content-Type: application/x-www-form-urlencoded; charset=UTF-8"
    
  • For the REST-JSON protocol, use
    "Content-Type: application/json; charset=UTF-8"
    

The Mastercard Payment Gateway will reject any characters that cannot be represented in either ISO-8859-1 or UTF-8 encoding.

Although UTF-8 is a supported character format, any field which may be sent to a credit card processor is restricted to ISO-8859-1 characters. This is due to downstream financial systems not being able to support all UTF-8 characters.

Copyright © 2023 Mastercard