1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
//! Unique Paddle IDs
use std::fmt;
use serde::{Deserialize, Serialize};
macro_rules! paddle_id {
($(#[$attr:meta])* $name:ident) => {
$(#[$attr])*
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct $name(pub String);
impl From<String> for $name {
fn from(value: String) -> Self {
$name(value)
}
}
impl From<&str> for $name {
fn from(value: &str) -> Self {
$name(value.to_string())
}
}
impl From<$name> for String {
fn from(value: $name) -> Self {
value.0
}
}
impl AsRef<str> for $name {
fn as_ref(&self) -> &str {
&self.0
}
}
impl fmt::Display for $name {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.0)
}
}
};
($($(#[$attr:meta])* $name:ident,)*) => {
$(
paddle_id! {
$(#[$attr])*
$name
}
)*
};
}
paddle_id! {
/// Unique Paddle ID for this address entity, prefixed with `add_`.
AddressID,
/// Unique Paddle ID for this customer entity, prefixed with `ctm_`.
CustomerID,
/// Unique Paddle ID for this adjustment entity, prefixed with `adj_`.
AdjustmentID,
/// Unique Paddle ID for this transaction entity, prefixed with `txn_`.
TransactionID,
/// Unique Paddle ID for this subscription entity, prefixed with `sub_`.
SubscriptionID,
/// Unique Paddle ID for this transaction item, prefixed with `txnitm_`. Used when working with [adjustments](https://developer.paddle.com/build/transactions/create-transaction-adjustments).
TransactionItemID,
/// Unique Paddle ID for this adjustment item, prefixed with `adjitm_`.
AdjustmentItemID,
/// Unique Paddle ID for this business entity, prefixed with `biz_`.
BusinessID,
/// Unique Paddle ID for this payment method entity, prefixed with `paymtd_`.
PaymentMethodID,
/// Unique Paddle ID for this customer portal session entity, prefixed with `cpls_`.
CustomerPortalSessionID,
/// Unique Paddle ID for this discount, prefixed with `dsc_`.
DiscountID,
/// Unique code that customers can use to apply this discount at checkout. Use letters and numbers only, up to 16 characters. Not case-sensitive.
DiscountCode,
/// Unique Paddle ID for this event, prefixed with `evt_`.
EventID,
/// Unique Paddle ID for this price, prefixed with `pri_`.
PriceID,
/// Unique Paddle ID for this product, prefixed with `pro_`.
ProductID,
/// Unique Paddle ID for API keys, prefixed with `apikey_`.
ApiKeyID,
/// Unique Paddle ID for payouts, prefixed with `payout_`.
PayoutID,
/// Unique Paddle ID for this notification, prefixed with `ntf_`.
NotificationID,
/// Unique Paddle ID for this notification setting, prefixed with `ntfset_`.
NotificationSettingID,
/// Unique Paddle ID for this notification log, prefixed with `ntflog_`.
NotificationLogID,
/// Webhook destination secret key, prefixed with `pdl_ntfset_`. Used for signature verification.
EndpointSecretKey,
/// Just a Paddle ID. I've noticed this used in some places.
PaddleID,
/// Unique Paddle ID for this simulation event, prefixed with `ntfsimevt_`.
SimulationEventID,
/// Unique Paddle ID for this simulation run, prefixed with `ntfsimrun_`.
SimulationRunID,
/// Unique Paddle ID for this simulation, prefixed with `ntfsim_`.
SimulationID,
/// Paddle ID of the invoice that this transaction is related to, prefixed with `inv_`. Used for compatibility with the Paddle Invoice API, which is now deprecated. This field is scheduled to be removed in the next version of the Paddle API.
InvoiceId,
}