Skip to content

Commit

Permalink
Add payment and getSwik function to the README
Browse files Browse the repository at this point in the history
  • Loading branch information
JuniorFt committed Mar 2, 2017
1 parent 83354d0 commit 357d803
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,37 @@ if ($result['status'] == 'ok') {
}
```

### Create a payment:
```PHP
<?php
// Create a swik object
$swik = new \Swikly\Swik();

// Set all the swik informations
$swik->setClientFirstName("Jean")
->setClientLastName("Dupont")
->setClientEmail("jean.dupont@gmail.com")
->setClientPhoneNumber("+33 6 20 20 20 20") // Send SMS to that number
->setClientLanguage("FR") // "EN", "FR", 'NL', 'DE'
->setSwikAmount("50")
->setSwikDescription("1h de canyoning le 12/08/2017....")
->setSwikId("YOUR_ID")
->setSendEmail("true")
->setCallbackUrl('https://mywebsite.com/resultSwik');

// Create and send your new swik to your client
$result = $swkAPI->newPayment($swik);

// Print result of the operation
if ($result['status'] == 'ok') {
echo "New payment created\n";
echo "Your client can pay you at that address: " . $result['acceptUrl'];
} else {
echo "Failed create a payment";
echo "Error = " . $result['message'];
}
```

### Cancel a swik:

```PHP
Expand All @@ -111,6 +142,30 @@ if ($result['status'] == 'ok') {
}
```

### Getting a specific Swik:

```PHP
<?php

// Create a swik object
$swik = new Swik();

// Set the Id you used to create it
$swik->setSwikId("YOUR_ID");

// Get the list of your swiks
$result = $swkAPI->getSwik($swik);

// Print result of the operation
if ($result['status'] == 'ok') {
echo "My swik = ";
print_r($result['swik']);
} else {
echo "Failed getting the swik list";
echo "Error = " . $result['message'];
}
```

### List all my Swiks

```PHP
Expand Down

0 comments on commit 357d803

Please sign in to comment.