Preloader

Examples

Ces exemples montrent comment connecter une plateforme marchande a l API Visa Gold de Magowallet. Les cles publickey et secretkey sont generees dans le dashboard marchand.

Base URL: https://magowallet.com

Gardez secretkey cote serveur uniquement. Ne l exposez jamais dans une app mobile, un navigateur ou un depot public.

Creer une Mastercard virtuelle

Cet exemple cree une carte pour un utilisateur de votre plateforme. Les cles viennent du dashboard marchand.

Endpoint: POST /api/visa/createcard

curl -X POST https://magowallet.com/api/visa/createcard
-H "Content-Type: application/json" 
-H "publickey: YOUR_PUBLIC_KEY" 
-H "secretkey: YOUR_SECRET_KEY" 
-d '{
  "firstname": "Jane",
  "lastname": "Doe",
  "email": "jane.doe@example.com",
  "initialload": 10.00,
  "reference": "card_order_1001"
}'
$response = Http::withHeaders([
    'Content-Type' => 'application/json',
    'publickey' => env('GOODPAY_PUBLIC_KEY'),
    'secretkey' => env('GOODPAY_SECRET_KEY'),
])->post('https://magowallet.com/api/visa/createcard', [
    'firstname' => 'Jane',
    'lastname' => 'Doe',
    'email' => 'jane.doe@example.com',
    'initialload' => 10.00,
    'reference' => 'card_order_1001',
]);
const response = await fetch('https://magowallet.com/api/visa/createcard', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    publickey: process.env.GOODPAY_PUBLIC_KEY,
    secretkey: process.env.GOODPAY_SECRET_KEY
  },
  body: JSON.stringify({
    firstname: 'Jane',
    lastname: 'Doe',
    email: 'jane.doe@example.com',
    initialload: 10.00,
    reference: 'card_order_1001'
  })
});

Recharger une Mastercard

Recharge une carte existante depuis le portefeuille marchand lie a la cle API.

Endpoint: POST /api/visa/fundcard

curl -X POST https://magowallet.com/api/visa/fundcard
-H "Content-Type: application/json" 
-H "publickey: YOUR_PUBLIC_KEY" 
-H "secretkey: YOUR_SECRET_KEY" 
-d '{
  "cardid": "card_yyyyyyyyyyyy",
  "email": "jane.doe@example.com",
  "amount": 25
}'
$response = Http::withHeaders([
    'Content-Type' => 'application/json',
    'publickey' => env('GOODPAY_PUBLIC_KEY'),
    'secretkey' => env('GOODPAY_SECRET_KEY'),
])->post('https://magowallet.com/api/visa/fundcard', [
    'cardid' => 'card_yyyyyyyyyyyy',
    'email' => 'jane.doe@example.com',
    'amount' => 25,
]);
const response = await fetch('https://magowallet.com/api/visa/fundcard', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    publickey: process.env.GOODPAY_PUBLIC_KEY,
    secretkey: process.env.GOODPAY_SECRET_KEY
  },
  body: JSON.stringify({
    cardid: 'card_yyyyyyyyyyyy',
    email: 'jane.doe@example.com',
    amount: 25
  })
});

Lire les details de carte

Recupere les informations d une carte creee par le marchand authentifie.

Endpoint: POST /api/visa/getcarddetails

curl -X POST https://magowallet.com/api/visa/getcarddetails
-H "Content-Type: application/json" 
-H "publickey: YOUR_PUBLIC_KEY" 
-H "secretkey: YOUR_SECRET_KEY" 
-d '{
  "email": "jane.doe@example.com",
  "cardid": "card_yyyyyyyyyyyy"
}'
$response = Http::withHeaders([
    'Content-Type' => 'application/json',
    'publickey' => env('GOODPAY_PUBLIC_KEY'),
    'secretkey' => env('GOODPAY_SECRET_KEY'),
])->post('https://magowallet.com/api/visa/getcarddetails', [
    'email' => 'jane.doe@example.com',
    'cardid' => 'card_yyyyyyyyyyyy',
]);
const response = await fetch('https://magowallet.com/api/visa/getcarddetails', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    publickey: process.env.GOODPAY_PUBLIC_KEY,
    secretkey: process.env.GOODPAY_SECRET_KEY
  },
  body: JSON.stringify({
    email: 'jane.doe@example.com',
    cardid: 'card_yyyyyyyyyyyy'
  })
});

Approuver une transaction 3DS

Approuve un evenement 3DS recu via webhook ou retourne par check3ds.

Endpoint: POST /api/visa/approve3ds

curl -X POST https://magowallet.com/api/visa/approve3ds
-H "Content-Type: application/json" 
-H "publickey: YOUR_PUBLIC_KEY" 
-H "secretkey: YOUR_SECRET_KEY" 
-d '{
  "email": "jane.doe@example.com",
  "cardid": "card_yyyyyyyyyyyy",
  "eventId": "event_zzzzzzzzzzzz"
}'
$response = Http::withHeaders([
    'Content-Type' => 'application/json',
    'publickey' => env('GOODPAY_PUBLIC_KEY'),
    'secretkey' => env('GOODPAY_SECRET_KEY'),
])->post('https://magowallet.com/api/visa/approve3ds', [
    'email' => 'jane.doe@example.com',
    'cardid' => 'card_yyyyyyyyyyyy',
    'eventId' => 'event_zzzzzzzzzzzz',
]);
const response = await fetch('https://magowallet.com/api/visa/approve3ds', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    publickey: process.env.GOODPAY_PUBLIC_KEY,
    secretkey: process.env.GOODPAY_SECRET_KEY
  },
  body: JSON.stringify({
    email: 'jane.doe@example.com',
    cardid: 'card_yyyyyyyyyyyy',
    eventId: 'event_zzzzzzzzzzzz'
  })
});

Demander OTP Wallet

Demande le statut OTP pour Google Pay ou Apple Pay. Le code final doit etre traite via webhook.

Endpoint: POST /api/visa/checkwallet

curl -X POST https://magowallet.com/api/visa/checkwallet
-H "Content-Type: application/json" 
-H "publickey: YOUR_PUBLIC_KEY" 
-H "secretkey: YOUR_SECRET_KEY" 
-d '{
  "email": "jane.doe@example.com",
  "cardid": "card_yyyyyyyyyyyy"
}'
$response = Http::withHeaders([
    'Content-Type' => 'application/json',
    'publickey' => env('GOODPAY_PUBLIC_KEY'),
    'secretkey' => env('GOODPAY_SECRET_KEY'),
])->post('https://magowallet.com/api/visa/checkwallet', [
    'email' => 'jane.doe@example.com',
    'cardid' => 'card_yyyyyyyyyyyy',
]);
const response = await fetch('https://magowallet.com/api/visa/checkwallet', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    publickey: process.env.GOODPAY_PUBLIC_KEY,
    secretkey: process.env.GOODPAY_SECRET_KEY
  },
  body: JSON.stringify({
    email: 'jane.doe@example.com',
    cardid: 'card_yyyyyyyyyyyy'
  })
});