Skip to main content

Metadata

Introduction

Metadata is a key/value object that can be attached to Payments, Invoices, and Tokens.

You can specify up to 30 keys, with key names up to 40 characters long and values up to 500 characters long.

Use cases

Metadata is useful for storing additional, structured information on an object. For example, you could store your user’s full name, email, and internal order id.

Important

Do not store any sensitive information (bank account numbers, card details, etc.) as metadata.

Moyasar doesn't use metadata to authorize or decline a charge—but you can use our list payment and list invoices. endpoints to filter by metadata.

Curl Request
curl https://api.moyasar.com/v1/payments \
-u sk_test_5cD409HqwpoOIDjqOPJPd: \
-d "metadata[order_id]"=1000
Success Response
{
"id": "760878ec-d1d3-5f72-9056-191683f55872",
"status": "paid",
"amount": 60000,
"fee": 1580,
"currency": "SAR",
"refunded": 0,
"refunded_at": null,
"captured": 0,
"captured_at": null,
"voided_at": null,
"description": null,
"amount_format": "600 SAR",
"fee_format": "15.80 SAR",
"refunded_format": "0.00 SAR",
"captured_format": "0.00 SAR",
"invoice_id": "9785ba96-a1be-5b13-a281-b27a4a6dad39",
"ip": null,
"callback_url": null,
"created_at": "2016-05-11T17:04:17.000Z",
"updated_at": "2016-05-12T17:04:19.633Z",
"metadata": {
"order_id": 1000,
"full_name": "Saleh Mohammed Ali"
},
"source": {
"type": "creditcard",
"company": "visa",
"name": "Saleh Ali",
"number": "XXXX-XXXX-XXXX-1111",
"message": null,
"transaction_url": null,
"gateway_id": "moyasar_cc_ce1iUidxhxhdbz74257S891wvW",
"reference_number": "125478454231"
}
}

Unsetting Keys

Individual keys can be unset by sending them an empty value. All keys can be unset by sending an empty value to metadata.