Download the PHP package yay-photobooks/partner-sdk without Composer
On this page you can find all versions of the php package yay-photobooks/partner-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yay-photobooks/partner-sdk
More information about yay-photobooks/partner-sdk
Files in yay-photobooks/partner-sdk
Package partner-sdk
Short Description PHP SDK for YAY Photobook Partner API - Create beautiful photobooks programmatically
License MIT
Homepage https://github.com/yay-photobooks/partner-sdk
Informations about the package partner-sdk
YAY Partner SDK (PHP)
A simple, type-safe PHP SDK for integrating with the YAY Photobook Partner API. Enable YAY to create beautiful photobooks for your customers.
Not using PHP?
We use a REST API that you can query with any language that supports HTTP requests.
The API specification is defined in openapi-partner-api.yaml (OpenAPI 3.1).
Features
- 🔒 Type-safe DTOs - Catch API changes at compile time
- 🌍 Environment support - Easy switching between sandbox and production
- 🐛 Debug-friendly - Access to original HTTP request/response data
- 📋 RFC 7807 compliant - Standardized error handling
- ⚡ Simple setup - Environment variable configuration with direnv support
Installation
Quick Start
1. Environment Setup
Set the variables as shown in the .envrc.example.
When you use direnv, its as simple as copying and modifiny .envrc.example
2. Create a Photobook Project
B2B preview-before-checkout (no address)
Partners can create a project before collecting the customer's postal address — the customer
fills it in during checkout in YAY's own form. See examples/create-project-no-address.php.
Webhooks
When the status of a project changes, we send a POST request to your webhook URL.
The SDK does not receive webhooks: handle them in your own application.
Setup: log in to the partner area and open /admin/webhooks (sandbox: /admin/webhooks).
Add your URL there and copy the signing secret (whsec_...).
Request:
failedPhotos is only sent with TRANSMISSION_FAILED.
Verify the signature as defined by Standard Webhooks, for example with composer require standard-webhooks/standard-webhooks:
Rules:
- Respond with a 2xx status. On any other response we retry with exponential backoff.
- Delivery is at-least-once. Use
webhook-idto ignore duplicates. - A project can receive a status more than once: a new preview after changes sends
REVIEW_PENDINGagain, and a new order sendsORDERED,IN_PRODUCTIONandSHIPPEDagain.
See the openapi-partner-api.yaml (webhooks section).
Environment Configuration
Required Environment Variables
| Variable | Description | Example |
|---|---|---|
YAY_PARTNER_USERNAME |
Your partner API username | your_partner_username |
YAY_PARTNER_PASSWORD |
Your partner API password | your_partner_password |
YAY_PARTNER_USER_AGENT |
Your application identifier | YourCompany/1.0 |
YAY_PARTNER_BASE_URL |
API base URL | https://sandbox.yayphotobooks.com |
API Base URLs
- Sandbox:
https://sandbox.yayphotobooks.com - Production:
https://portal.yayphotobooks.com - Development:
https://photobooks-portal.local.dev
The .envrc file automatically sets YAY_PARTNER_BASE_URL based on your YAY_PARTNER_ENVIRONMENT setting.
Error Handling
The SDK follows RFC 7807 (Problem Details for HTTP APIs) for consistent error handling:
Common Error Codes
| HTTP Status | Error Type | Description |
|---|---|---|
| 400 | validation_failed |
Invalid request data (missing fields, wrong format) |
| 401 | authentication_failed |
Invalid credentials |
| 404 | not_found |
Invalid endpoint |
| 500 | server_error |
Internal YAY error |
API Reference
CreateProjectRequest
Customer
Address
Upload
Development
Setup Development Environment
Running Tests
Code Quality
Support
- 📖 API Specification:
openapi-partner-api.yaml - 🐛 Issues: GitHub Issues
- 💬 Support: [email protected]
License
This SDK is open-source software licensed under the MIT License.
Made with ❤️ by YAY Photobooks