Selling Cryptocurrency
This procedure describes how a merchant sells cryptocurrency to a customer. Rapyd transfers fiat currency from the customer's card to the merchant's Rapyd Wallet, and the merchant credits the customer's cryptocurrency account on the merchant's own books. This procedure is relevant to merchants that are specifically licensed to sell cryptocurrencies.
Because cryptocurrency is a high-risk industry, you must set specific parameters correctly for compliance with applicable laws and regulations.
Nota
The cryptocurrency feature is in beta testing. To enable this feature, contact Rapyd Client Support.
Relevant to payment method types that support this feature.
How
This procedure includes the following steps:
Create Customer
For all cryptocurrency transactions, certain personal information is required for the customer. Some payment methods allow you to include this information directly in the request to create payment. If not, then you must include the ID of the 'customer' object that contains this information. You can create the customer with this information, or add it later using Update Customer. This example illustrates how to do this using Create Customer.
Run Create Customer with the following parameters:
address.line_1- Building number and street name. Required.address.city(recommended) - City portion of the address.address.country- The two-letter ISO 3166-1 ALPHA-2 code for the country. Required.address.zip- Postal code portion of the address. Required.birth_country(recommended) - Country where the customer was born. Two-letter ISO 3166-1 ALPHA-2 code for the country.email(recommended) - Customer's email address.date_of_birth- Date of birth of the customer. Format: DD/MM/YYYY. Required.nationality(recommended) - The country of the customer's primary citizenship. Two-letter ISO 3166-1 ALPHA-2 code for the country.occupation(recommended) - Occupation of the customer. Maximum: 35 characters.
Request
curl -X post 'https://api.rapyd.net/v1/customers' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "name": "John Doe", "addresses": [{ "name": "John Doe", "line_1": "123 First Street", "city": "Anytown", "country": "IS", "zip": "12345" }], "birth_country": "IS", "date_of_birth": "15/01/2001", "email": "johndoe@rapyd.net", "ewallet": "ewallet_3da471747970b566030d10ca6d46a38c", "nationality": "IS", "occupation": "Student" }'
Response
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "c7866b36-3914-4135-b52e-eff6dbb4150b" }, "data": { "id": "cus_d81ea43f7bd24e2f647da79f32b9d2d0", "delinquent": false, "discount": null, "name": "John Doe", "default_payment_method": "", "description": "", "email": "johndoe@rapyd.net", "phone_number": "", "invoice_prefix": "", "addresses": [ { "id": "address_0e2384004f0e916f1fb633bddb7526a6", "name": "John Doe", "line_1": "123 First Street", "line_2": "", "line_3": "", "city": "Anytown", "state": "", "country": "IS", "zip": "12345", "phone_number": "", "metadata": {}, "canton": "", "district": "", "created_at": 1769007140 } ], "payment_methods": null, "subscriptions": null, "created_at": 1769007140, "metadata": {}, "business_vat_id": "", "ewallet": "ewallet_3da471747970b566030d10ca6d46a38c", "occupation": "Student", "birth_country": "IS", "date_of_birth": "15/01/2001", "nationality": "IS" } }
Transfer Funds from Card to Client Wallet
This step creates a payment that transfers fiat currency from the customer's card to the merchant's client wallet.
Run Create Payment with the following parameters:
customer- Set the ID of the customer, a string starting with customer_.In the
payment_method_optionsobject, set the following parameters:aft- Set to true.is_direct_purchase- Set to one of the following values:true - The transaction is intended to immediately provide cryptocurrency to the customer.
false - The transaction is intended for pre-funding an account for later purchase of cryptocurrency.
purpose_code- Set to crypto_currencyspecial_condition_indicator- Set to cryptocurrency.
Request
curl -X post 'https://api.rapyd.net/v1/payments' \ -H 'access_key: your-access-key-here' \ -H 'Content-Type: application/json' \ -H 'idempotency: your-idempotency-parameter-here' \ -H 'salt: your-random-string-here' \ -H 'signature: your-calculated-signature-here' \ -H 'timestamp: your-unix-timestamp-here' \ --data-raw '{ "amount": 100, "currency": "EUR", "customer": "cus_d81ea43f7bd24e2f647da79f32b9d2d0", "payment_method": { "type": "at_mastercard_card", "fields": { "number": "4111111111111111", "expiration_month": "12", "expiration_year": "30", "name": "John Doe", "cvv": "345" } }, "payment_method_options": { "aft": true, "is_direct_purchase": true, "purpose_code": "crypto_currency", "special_condition_indicator": "cryptocurrency" } }'
Response
{ "status": { "error_code": "", "status": "SUCCESS", "message": "", "response_code": "", "operation_id": "a4d01997-c988-4747-b730-130d800ada31" }, "data": { "id": "payment_0989e69672a242d605da6744d73581f9", "amount": 100, "original_amount": 100, "is_partial": false, "currency_code": "EUR", "country_code": "AT", "status": "CLO", "description": "", "merchant_reference_id": "", "customer_token": "cus_d81ea43f7bd24e2f647da79f32b9d2d0", "payment_method": null, "payment_method_data": { "id": card_38f74ed0a42211b2c9a08aa945074875, "type": "at_mastercard_card", "category": "card", "metadata": null, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable", "name": "John Doe", "last4": "1111", "acs_check": "unchecked", "cvv_check": "unchecked", "bin_details": { "type": "CREDIT", "brand": "VISA", "level": "CLASSIC", "country": "NL", "bin_number": "411111" }, "expiration_year": "31", "expiration_month": "11", "fingerprint_token": "ocfp_c6abbccb3440fcb0fc34ae14126607fa", "network_reference_id": "000000111222999", "payment_account_reference": "V0010013018036782991622965076" }, "auth_code": 003603, "expiration": 1748504528, "captured": true, "refunded": false, "refunded_amount": 0, "receipt_email": "", "redirect_url": "", "complete_payment_url": "https://complete.example.net", "error_payment_url": "https://error.example.net", "receipt_number": "", "flow_type": "", "address": null, "statement_descriptor": "Doc Team", "transaction_id": "", "created_at": 1747899728, "metadata": null, "failure_code": "", "failure_message": "", "paid": true, "paid_at": 1747899729, "dispute": null, "refunds": null, "order": null, "outcome": null, "visual_codes": {}, "textual_codes": {}, "instructions": {}, "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "ewallets": [ { "ewallet_id": "ewallet_c1943cfeda5f98247ab117e5d2648861", "amount": 100, "percent": 100, "refunded_amount": 0 } ], "payment_method_options": { "aft": true, "purpose_code": "high_risk_securities", "is_direct_purchase": true }, "payment_method_type": "nl_mastercard_card", "payment_method_type_category": "card", "fx_rate": 1, "merchant_requested_currency": null, "merchant_requested_amount": null, "fixed_side": "", "payment_fees": null, "invoice": "", "escrow": null, "group_payment": "", "cancel_reason": null, "initiation_type": "customer_present", "mid": "mid_7b624b32f161313347d554138d81858", "next_action": "not_applicable", "error_code": "", "remitter_information": {}, "save_payment_method": false, "merchant_advice_code": null, "merchant_advice_message": null, "transaction_link_id": null } }