Website logo
Create AccountSign In
⌘K
Moyasar Documentation
Payments
Credit Card
Apple Pay
STC Pay
Tokenization
Payment Errors
Form Configuration
Payouts
Invoices
Creating invoices
Mobile SDKs
iOS SDK
Android SDK
Flutter SDK
Hosted Checkout
E-Commerce Plugins
WooCommerce
PrestaShop
NopCommerce
OpenCart
Magento2
Testing
Testing Cards
Apple Pay Testing
Custom Payments
Credit Cards
STC Pay
Apple Pay on Websites
Apple Pay on Apps
Tokenized Cards
Dashboard
Apple Pay Using Developer Account
Apple Pay Using Web Registration
Get Your API Keys
Setting up your IP whitelist
Setting up Webhooks
API
Introduction
Authentication
Pagination
Metadata
Payments
Payouts
Invoices
Tokens
Apple Pay
Webhooks
Errors
Support
Help Desk
Docs powered by Archbee
API
Payments

Create Payment (Apple Pay)

1min
Use this endpoint to create payment requests using an Apple Pay token, taken from the `onpaymentauthorized`event
POST
Params
Body Parameters
amount
required
String
Amount intended to be collected by this payment. A positive integer represents how much to charge in the smallest currency unit (e.g., 100 Halala to charge 1.00 SAR or 100 to charge ¥100, a zero-decimal currency). The minimum amount is 1 SAR or equivalent in charge currency.
currnecy
optional
String
3-letter ISO code for currency. E.g., SAR, CAD, USD. (default: SAR)
description
optional
String
An arbitrary string that you can attach to a payment object. The description is only for your reference and it is NOT displayed to users.
source
required
Object
A payment source object to be charged, such as Apple Pay source, Credit Card source, or STC pay source. The details are described below. ('creditcard' for this example)
metadata
optional
Object
Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
Curl
curl -X POST https://api.moyasar.com/v1/payments \
     -u pk_test_MrtwozLJAuFmLKWWSaRaoaLX: \
     -d amount=60000 \
     -d currency="SAR" \
     -d description="Payment for Kindle Paperwhite" \
     -d source['type']="applepay" \
     -d source['token']= "{
          "data":"...",
          "signature":"...",
          "version":"..",
          "header":{
            "applicationData":"...",
            "ephemeralPublicKey":"...",
            "wrappedKey":"...",
            "publicKeyHash":"...",
            "transactionId":"..."
           }
     }" \
Responses
201
400
{
  "id": "760878ec-d1d3-5f72-9056-191683f55872",
  "status": "initiated",
  "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": null,
  "source": {
        "type": "applepay",
        "company": "mada",
        "name": null,
        "number": "XXXX-XXXX-XXXX-0000",
        "gateway_id": "moyasar_ap_ePhJsQAQ3qwFHjQE5o9ConY",
        "reference_number": "323215331950",
        "message": "APPROVED"
    }
}




Updated 23 Nov 2023
Did this page help you?
PREVIOUS
Create Payment (Token)
NEXT
Create Payment (STC Pay)
Docs powered by Archbee
TABLE OF CONTENTS
POST
Create Payment
Docs powered by Archbee