hyperswitch
hyperswitch copied to clipboard
feat(router): adding generic tokenization endpoint
Type of Change
- [ ] Bugfix
- [x] New feature
- [ ] Enhancement
- [ ] Refactoring
- [ ] Dependency updates
- [x] Documentation
- [ ] CI/CD
Description
Create a new set of endpoints for giving tokenization as a service for generic usage, current motivation of the service is to be used in proxy payment service.
Additional Changes
- [ ] This PR modifies the API contract
- [x] This PR modifies the database schema
- [ ] This PR modifies application configuration/environment variables
Motivation and Context
How did you test it?
Create a token
curl --location 'http: //localhost:8080/v2/tokenize' \
--header 'x-profile-id: pro_neU1Qn8gnIich0LAaQXm' \
--header 'Authorization: publishable-key=PUBLISHABLE_KEY,client-secret=CLIENT_SECRET' \
--header 'Content-Type: application/json' \
--data '{
"customer_id": customer_id,
"token_request": {
"payment_method_data": {
"card": {
"card_holder_name": "Narayan Bhat"
}
}
}
}'
Response
{
"id": "12345_tok_01966c6515157c3193db1c2502435ad5",
"created_at": "2025-04-25 10:01:26.037519",
"flag": "enabled"
}
Checklist
- [ ] I formatted the code
cargo +nightly fmt --all - [ ] I addressed lints thrown by
cargo clippy - [ ] I reviewed the submitted code
- [ ] I added unit tests for my changes where possible