payment_processor.proto 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. syntax = "proto3";
  2. package cdk_payment_processor;
  3. service CdkPaymentProcessor {
  4. rpc GetSettings(EmptyRequest) returns (SettingsResponse) {}
  5. rpc CreatePayment(CreatePaymentRequest) returns (CreatePaymentResponse) {}
  6. rpc GetPaymentQuote(PaymentQuoteRequest) returns (PaymentQuoteResponse) {}
  7. rpc MakePayment(MakePaymentRequest) returns (MakePaymentResponse) {}
  8. rpc CheckIncomingPayment(CheckIncomingPaymentRequest) returns (CheckIncomingPaymentResponse) {}
  9. rpc CheckOutgoingPayment(CheckOutgoingPaymentRequest) returns (MakePaymentResponse) {}
  10. rpc WaitIncomingPayment(EmptyRequest) returns (stream WaitIncomingPaymentResponse) {}
  11. }
  12. message EmptyRequest {}
  13. message SettingsResponse {
  14. string inner = 1;
  15. }
  16. message Bolt11IncomingPaymentOptions {
  17. optional string description = 1;
  18. uint64 amount = 2;
  19. optional uint64 unix_expiry = 3;
  20. }
  21. message Bolt12IncomingPaymentOptions {
  22. optional string description = 1;
  23. optional uint64 amount = 2;
  24. optional uint64 unix_expiry = 3;
  25. }
  26. enum PaymentMethodType {
  27. BOLT11 = 0;
  28. BOLT12 = 1;
  29. }
  30. enum OutgoingPaymentRequestType {
  31. BOLT11_INVOICE = 0;
  32. BOLT12_OFFER = 1;
  33. }
  34. enum PaymentIdentifierType {
  35. PAYMENT_HASH = 0;
  36. OFFER_ID = 1;
  37. LABEL = 2;
  38. BOLT12_PAYMENT_HASH = 3;
  39. CUSTOM_ID = 4;
  40. PAYMENT_ID = 5;
  41. }
  42. message PaymentIdentifier {
  43. PaymentIdentifierType type = 1;
  44. oneof value {
  45. string hash = 2; // Used for PAYMENT_HASH and BOLT12_PAYMENT_HASH
  46. string id = 3; // Used for OFFER_ID, LABEL, and CUSTOM_ID
  47. }
  48. }
  49. message IncomingPaymentOptions {
  50. oneof options {
  51. Bolt11IncomingPaymentOptions bolt11 = 1;
  52. Bolt12IncomingPaymentOptions bolt12 = 2;
  53. }
  54. }
  55. message CreatePaymentRequest {
  56. string unit = 1;
  57. IncomingPaymentOptions options = 2;
  58. }
  59. message CreatePaymentResponse {
  60. PaymentIdentifier request_identifier = 1;
  61. string request = 2;
  62. optional uint64 expiry = 3;
  63. }
  64. message Mpp {
  65. uint64 amount = 1;
  66. }
  67. message Amountless {
  68. uint64 amount_msat = 1;
  69. }
  70. message MeltOptions {
  71. oneof options {
  72. Mpp mpp = 1;
  73. Amountless amountless = 2;
  74. }
  75. }
  76. message PaymentQuoteRequest {
  77. string request = 1;
  78. string unit = 2;
  79. optional MeltOptions options = 3;
  80. OutgoingPaymentRequestType request_type = 4;
  81. }
  82. enum QuoteState {
  83. UNPAID = 0;
  84. PAID = 1;
  85. PENDING = 2;
  86. UNKNOWN = 3;
  87. FAILED = 4;
  88. ISSUED = 5;
  89. }
  90. message PaymentQuoteResponse {
  91. PaymentIdentifier request_identifier = 1;
  92. uint64 amount = 2;
  93. uint64 fee = 3;
  94. QuoteState state = 4;
  95. string unit = 5;
  96. }
  97. message Bolt11OutgoingPaymentOptions {
  98. string bolt11 = 1;
  99. optional uint64 max_fee_amount = 2;
  100. optional uint64 timeout_secs = 3;
  101. optional MeltOptions melt_options = 4;
  102. }
  103. message Bolt12OutgoingPaymentOptions {
  104. string offer = 1;
  105. optional uint64 max_fee_amount = 2;
  106. optional uint64 timeout_secs = 3;
  107. optional MeltOptions melt_options = 5;
  108. }
  109. enum OutgoingPaymentOptionsType {
  110. OUTGOING_BOLT11 = 0;
  111. OUTGOING_BOLT12 = 1;
  112. }
  113. message OutgoingPaymentVariant {
  114. oneof options {
  115. Bolt11OutgoingPaymentOptions bolt11 = 1;
  116. Bolt12OutgoingPaymentOptions bolt12 = 2;
  117. }
  118. }
  119. message MakePaymentRequest {
  120. OutgoingPaymentVariant payment_options = 1;
  121. optional uint64 partial_amount = 2;
  122. optional uint64 max_fee_amount = 3;
  123. }
  124. message MakePaymentResponse {
  125. PaymentIdentifier payment_identifier = 1;
  126. optional string payment_proof = 2;
  127. QuoteState status = 3;
  128. uint64 total_spent = 4;
  129. string unit = 5;
  130. }
  131. message CheckIncomingPaymentRequest {
  132. PaymentIdentifier request_identifier = 1;
  133. }
  134. message CheckIncomingPaymentResponse {
  135. repeated WaitIncomingPaymentResponse payments = 1;
  136. }
  137. message CheckOutgoingPaymentRequest {
  138. PaymentIdentifier request_identifier = 1;
  139. }
  140. message WaitIncomingPaymentResponse {
  141. PaymentIdentifier payment_identifier = 1;
  142. uint64 payment_amount = 2;
  143. string unit = 3;
  144. string payment_id = 4;
  145. }