- email: [email protected]
- Name: Svetoslav Stefanov (Svet)
git clone https://github.com/SvetoslavStefanov/hofman.git
cd hofman
composer install
php artisan migrate
- Copy .env.example to .env
- Populate your
MOLLIE_KEY
&HUBSPOT_API_KEY
to your.env
file php artisan serve
- send a post request to
http://127.0.0.1:8000/api/orders
- The request should contain the following data:
{
"email": "[email protected]",
"order_items": [
{
"product_id": 2,
"quantity": 1
}
}
- Follow the link returned in the response payment.payment_link
- Enter this data there:
- Card Number: 5555 4444 3333 1111
- Expiry Date: Any future date
- CVC: Any 3 digits
- Then send a POST request to simulate a webhook call from Mollie to
http://127.0.0.1:8000/api/orders/9/payment
(where9
is your order ID)
{
"id": "tr_fcYhd69pEh",
"amount": {
"currency": "EUR",
"value": "15.00"
},
"description": "Order 7",
"metadata": {
"order_id": "F2024071100507"
},
"status": "paid",
"createdAt": "2024-07-11T10:32:08+00:00",
"paidAt": "2024-07-11T10:32:08+00:00",
"paymentUrl": "http://example.com/payment/7",
"webhookUrl": "http://213.91.182.221:8000/api/orders/7/payment"
}
In this case only the id
field matters. You could get the proper ID from Mollie's dashboard.
- I wanted to send emails via a Queue in order not to slow down the request, but running things on a local environment would make it more difficult. Because of that, I made that I left the
QUEUE_CONNECTION
constant tosync
- The
APP_URL
has to be a public url, likeAPP_URL=http://213.91.182.221:8000
, otherwise Mollie couldn't use it as a webhook url - Hubspot Contact is not associated to the newly created Deal. Also a Company is not being created.
- Create a New Order
{
"email": "[email protected]",
"order_items": [
{
"product_id": 2,
"quantity": 1
}
]
}
{
"email": "[email protected]",
"total_price": 99.99,
"updated_at": "2024-07-11T14:07:42.000000Z",
"created_at": "2024-07-11T14:07:42.000000Z",
"id": 10,
"ref_id": "F2024071100510",
"items": [
{
"id": 14,
"order_id": 10,
"product_id": 2,
"quantity": 1,
"price": "99.99",
"created_at": "2024-07-11T14:07:42.000000Z",
"updated_at": "2024-07-11T14:07:42.000000Z",
"product": {
"id": 2,
"name": "Product Name",
"description": "Product Description",
"price": "99.99",
"sku": "unique-sku-001",
"category": "Home",
"deleted_at": null,
"created_at": "2024-07-11T07:31:24.000000Z",
"updated_at": "2024-07-11T07:31:24.000000Z"
}
}
],
"payment": {
"id": 5,
"order_id": 10,
"paid_at": null,
"payment_link": "https:\/\/www.mollie.com\/checkout\/credit-card\/embedded\/xByanxNALB",
"created_at": "2024-07-11T14:07:44.000000Z",
"updated_at": "2024-07-11T14:07:44.000000Z"
}
}
- Retrieve All Orders
[
{
"id": 10,
"email": "[email protected]",
"ref_id": "F2024071100510",
"total_price": "99.99",
"created_at": "2024-07-11T14:07:42.000000Z",
"updated_at": "2024-07-11T14:07:42.000000Z",
"items": [
{
"id": 14,
"order_id": 10,
"product_id": 2,
"quantity": 1,
"price": "99.99",
"created_at": "2024-07-11T14:07:42.000000Z",
"updated_at": "2024-07-11T14:07:42.000000Z",
"product": {
"id": 2,
"name": "Product Name",
"description": "Product Description",
"price": "99.99",
"sku": "unique-sku-001",
"category": "Home",
"deleted_at": null,
"created_at": "2024-07-11T07:31:24.000000Z",
"updated_at": "2024-07-11T07:31:24.000000Z"
}
}
]
}
]
- Payment success url
- Confirm payment (Webhook called from Mollie)
- Create a New Product
{
"name": "Paco",
"description": "Product Description",
"price": 20,
"sku": "unique-sku-002",
"category": "Home"
}
{
"name": "Paco",
"description": "Product Description",
"price": 20,
"sku": "unique-sku-002",
"updated_at": "2024-07-11T08:07:38.000000Z",
"created_at": "2024-07-11T08:07:38.000000Z",
"id": 3
}
- Retrieve All Products
{
"current_page": 1,
"data": [
{
"id": 1,
"name": "Product Name",
"description": "Product Description",
"price": "99.99",
"sku": "unique-sku-001",
"category": "Home",
"deleted_at": null,
"created_at": "2024-07-11T07:17:08.000000Z",
"updated_at": "2024-07-11T07:17:08.000000Z"
}
],
"first_page_url": "http:\/\/127.0.0.1:8000\/api\/products?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http:\/\/127.0.0.1:8000\/api\/products?page=1",
"links": [
{
"url": null,
"label": "« Previous",
"active": false
},
{
"url": "http:\/\/127.0.0.1:8000\/api\/products?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next »",
"active": false
}
],
"next_page_url": null,
"path": "http:\/\/127.0.0.1:8000\/api\/products",
"per_page": 10,
"prev_page_url": null,
"to": 1,
"total": 1
}
- Retrieve a Specific Product
{
"id": 2,
"name": "Product Name",
"description": "Product Description",
"price": "99.99",
"sku": "unique-sku-001",
"category": "Home",
"deleted_at": null,
"created_at": "2024-07-11T07:31:24.000000Z",
"updated_at": "2024-07-11T07:31:24.000000Z"
}
- Update a Specific Product
{
"name": "Updated Product Name",
"description": "Updated Product Description",
"price": 79.99,
"sku": "updated-unique-sku-001",
"category": "Kitchen"
}
All parameters are optional 9. Delete a Specific Product
{
"message": "Product deleted successfully."
}