Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from mollie/issue/21-add-customer-update
Issue/21 add customer update
- Loading branch information
Showing
5 changed files
with
128 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
/* | ||
* Example 18 - Updating an existing customer via the Mollie API. | ||
*/ | ||
|
||
try | ||
{ | ||
/* | ||
* Initialize the Mollie API library with your API key or OAuth access token. | ||
*/ | ||
include "initialize.php"; | ||
|
||
/* | ||
* Retrieve an existing customer by his customerId | ||
*/ | ||
$customer = $mollie->customers->get("cst_zAQzfr3Raq"); | ||
|
||
/** | ||
* Customer fields that can be updated. | ||
* | ||
* @See https://www.mollie.com/en/docs/reference/customers/update | ||
*/ | ||
$customer->name = "Luke Skywalker"; | ||
$customer->email = "luke@example.org"; | ||
$customer->locale = "en"; | ||
$customer->metadata->isJedi = TRUE; | ||
|
||
$customer = $mollie->customers->update($customer); | ||
|
||
echo "<p>Customer updated: " . htmlspecialchars($customer->name) . "</p>"; | ||
} | ||
catch (Mollie_API_Exception $e) | ||
{ | ||
echo "API call failed: " . htmlspecialchars($e->getMessage()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters