I'm creating a client and an offer in Paymill but I don't know how to add payment details to the client, and then assign the offer to the client. Does anyone know how I can do this?
Here is my code that creates both the client and the offer:
$params = array(
'amount' => '3000', // E.g. "4200" for 42.00 EUR
'currency' => 'GBP', // ISO 4217
'interval' => '1 MONTH', // Options: "# DAY", "# WEEK", "# MONTH" and "# YEAR"
'name' => 'Tier 1'
);
$apiKey = '111111111111111111111';
$apiEndpoint = 'https://api.paymill.com/v2/';
$offersObject = new Services_Paymill_Offers($apiKey, $apiEndpoint);
$offer = $offersObject->create($params);
$email = $_POST['email'];
$description = "Tier 1";
$clientsObject = new Services_Paymill_Clients($apiKey, $apiEndpoint);
$client = $clientsObject->create(array(
'email' => $email,
'description' => $description
));
print_r($clientsObject);
echo "tier 1 success<br/><br/>";
print_r($offersObject);
I'm finding it difficult to grasp from the documentation and haven't managed to find a tutorial yet- Any help would be amazing! Thanks, Joe
You have to create a client, payment and an offer. After that, create a subscription with the created client, payment and offer.
The following code will solve this issue:
Best regards
Ringo
Paymill Developer